{"ast":null,"code":"import _regeneratorRuntime from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";\nimport _asyncToGenerator from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport _createForOfIteratorHelper from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js\";\nimport _defineProperty from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport _toConsumableArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport _objectSpread from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";\nimport _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport _objectWithoutProperties from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js\";\nvar _excluded = [\"children\"],\n  _excluded2 = [\"name\"],\n  _excluded3 = [\"_f\"],\n  _excluded4 = [\"_f\"];\nimport React from 'react';\nvar isCheckBoxInput = function isCheckBoxInput(element) {\n  return element.type === 'checkbox';\n};\nvar isDateObject = function isDateObject(value) {\n  return value instanceof Date;\n};\nvar isNullOrUndefined = function isNullOrUndefined(value) {\n  return value == null;\n};\nvar isObjectType = function isObjectType(value) {\n  return typeof value === 'object';\n};\nvar isObject = function isObject(value) {\n  return !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);\n};\nvar getEventValue = function getEventValue(event) {\n  return isObject(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;\n};\nvar getNodeParentName = function getNodeParentName(name) {\n  return name.substring(0, name.search(/\\.\\d+(\\.|$)/)) || name;\n};\nvar isNameInFieldArray = function isNameInFieldArray(names, name) {\n  return names.has(getNodeParentName(name));\n};\nvar compact = function compact(value) {\n  return Array.isArray(value) ? value.filter(Boolean) : [];\n};\nvar isUndefined = function isUndefined(val) {\n  return val === undefined;\n};\nvar _get = function get(obj, path, defaultValue) {\n  if (!path || !isObject(obj)) {\n    return defaultValue;\n  }\n  var result = compact(path.split(/[,[\\].]+?/)).reduce(function (result, key) {\n    return isNullOrUndefined(result) ? result : result[key];\n  }, obj);\n  return isUndefined(result) || result === obj ? isUndefined(obj[path]) ? defaultValue : obj[path] : result;\n};\nvar EVENTS = {\n  BLUR: 'blur',\n  FOCUS_OUT: 'focusout',\n  CHANGE: 'change'\n};\nvar VALIDATION_MODE = {\n  onBlur: 'onBlur',\n  onChange: 'onChange',\n  onSubmit: 'onSubmit',\n  onTouched: 'onTouched',\n  all: 'all'\n};\nvar INPUT_VALIDATION_RULES = {\n  max: 'max',\n  min: 'min',\n  maxLength: 'maxLength',\n  minLength: 'minLength',\n  pattern: 'pattern',\n  required: 'required',\n  validate: 'validate'\n};\nvar HookFormContext = React.createContext(null);\n/**\r\n * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.\r\n *\r\n * @remarks\r\n * [API](https://react-hook-form.com/api/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\r\n *\r\n * @returns return all useForm methods\r\n *\r\n * @example\r\n * ```tsx\r\n * function App() {\r\n *   const methods = useForm();\r\n *   const onSubmit = data => console.log(data);\r\n *\r\n *   return (\r\n *     <FormProvider {...methods} >\r\n *       <form onSubmit={methods.handleSubmit(onSubmit)}>\r\n *         <NestedInput />\r\n *         <input type=\"submit\" />\r\n *       </form>\r\n *     </FormProvider>\r\n *   );\r\n * }\r\n *\r\n *  function NestedInput() {\r\n *   const { register } = useFormContext(); // retrieve all hook methods\r\n *   return <input {...register(\"test\")} />;\r\n * }\r\n * ```\r\n */\nvar useFormContext = function useFormContext() {\n  return React.useContext(HookFormContext);\n};\n/**\r\n * A provider component that propagates the `useForm` methods to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useFormContext}.\r\n *\r\n * @remarks\r\n * [API](https://react-hook-form.com/api/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\r\n *\r\n * @param props - all useFrom methods\r\n *\r\n * @example\r\n * ```tsx\r\n * function App() {\r\n *   const methods = useForm();\r\n *   const onSubmit = data => console.log(data);\r\n *\r\n *   return (\r\n *     <FormProvider {...methods} >\r\n *       <form onSubmit={methods.handleSubmit(onSubmit)}>\r\n *         <NestedInput />\r\n *         <input type=\"submit\" />\r\n *       </form>\r\n *     </FormProvider>\r\n *   );\r\n * }\r\n *\r\n *  function NestedInput() {\r\n *   const { register } = useFormContext(); // retrieve all hook methods\r\n *   return <input {...register(\"test\")} />;\r\n * }\r\n * ```\r\n */\nvar FormProvider = function FormProvider(props) {\n  var children = props.children,\n    data = _objectWithoutProperties(props, _excluded);\n  return React.createElement(HookFormContext.Provider, {\n    value: data\n  }, children);\n};\nvar getProxyFormState = function getProxyFormState(formState, control, localProxyFormState) {\n  var isRoot = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n  var result = {\n    defaultValues: control._defaultValues\n  };\n  var _loop = function _loop(key) {\n    Object.defineProperty(result, key, {\n      get: function get() {\n        var _key = key;\n        if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {\n          control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;\n        }\n        localProxyFormState && (localProxyFormState[_key] = true);\n        return formState[_key];\n      }\n    });\n  };\n  for (var key in formState) {\n    _loop(key);\n  }\n  return result;\n};\nvar isEmptyObject = function isEmptyObject(value) {\n  return isObject(value) && !Object.keys(value).length;\n};\nvar shouldRenderFormState = function shouldRenderFormState(formStateData, _proxyFormState, isRoot) {\n  var name = formStateData.name,\n    formState = _objectWithoutProperties(formStateData, _excluded2);\n  return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find(function (key) {\n    return _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all);\n  });\n};\nvar convertToArrayPayload = function convertToArrayPayload(value) {\n  return Array.isArray(value) ? value : [value];\n};\nvar shouldSubscribeByName = function shouldSubscribeByName(name, signalName, exact) {\n  return exact && signalName ? name === signalName : !name || !signalName || name === signalName || convertToArrayPayload(name).some(function (currentName) {\n    return currentName && (currentName.startsWith(signalName) || signalName.startsWith(currentName));\n  });\n};\nfunction useSubscribe(props) {\n  var _props = React.useRef(props);\n  _props.current = props;\n  React.useEffect(function () {\n    var subscription = !props.disabled && _props.current.subject.subscribe({\n      next: _props.current.callback\n    });\n    return function () {\n      subscription && subscription.unsubscribe();\n    };\n  }, [props.disabled]);\n}\n\n/**\r\n * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.\r\n *\r\n * @remarks\r\n * [API](https://react-hook-form.com/api/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)\r\n *\r\n * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}\r\n *\r\n * @example\r\n * ```tsx\r\n * function App() {\r\n *   const { register, handleSubmit, control } = useForm({\r\n *     defaultValues: {\r\n *     firstName: \"firstName\"\r\n *   }});\r\n *   const { dirtyFields } = useFormState({\r\n *     control\r\n *   });\r\n *   const onSubmit = (data) => console.log(data);\r\n *\r\n *   return (\r\n *     <form onSubmit={handleSubmit(onSubmit)}>\r\n *       <input {...register(\"firstName\")} placeholder=\"First Name\" />\r\n *       {dirtyFields.firstName && <p>Field is dirty.</p>}\r\n *       <input type=\"submit\" />\r\n *     </form>\r\n *   );\r\n * }\r\n * ```\r\n */\nfunction useFormState(props) {\n  var methods = useFormContext();\n  var _ref = props || {},\n    _ref$control = _ref.control,\n    control = _ref$control === void 0 ? methods.control : _ref$control,\n    disabled = _ref.disabled,\n    name = _ref.name,\n    exact = _ref.exact;\n  var _React$useState = React.useState(control._formState),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    formState = _React$useState2[0],\n    updateFormState = _React$useState2[1];\n  var _mounted = React.useRef(true);\n  var _localProxyFormState = React.useRef({\n    isDirty: false,\n    dirtyFields: false,\n    touchedFields: false,\n    isValidating: false,\n    isValid: false,\n    errors: false\n  });\n  var _name = React.useRef(name);\n  _name.current = name;\n  useSubscribe({\n    disabled: disabled,\n    callback: React.useCallback(function (value) {\n      return _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current) && updateFormState(_objectSpread(_objectSpread({}, control._formState), value));\n    }, [control, exact]),\n    subject: control._subjects.state\n  });\n  React.useEffect(function () {\n    _mounted.current = true;\n    return function () {\n      _mounted.current = false;\n    };\n  }, []);\n  return getProxyFormState(formState, control, _localProxyFormState.current, false);\n}\nvar isString = function isString(value) {\n  return typeof value === 'string';\n};\nvar generateWatchOutput = function generateWatchOutput(names, _names, formValues, isGlobal) {\n  var isArray = Array.isArray(names);\n  if (isString(names)) {\n    isGlobal && _names.watch.add(names);\n    return _get(formValues, names);\n  }\n  if (isArray) {\n    return names.map(function (fieldName) {\n      return isGlobal && _names.watch.add(fieldName), _get(formValues, fieldName);\n    });\n  }\n  isGlobal && (_names.watchAll = true);\n  return formValues;\n};\nvar isFunction = function isFunction(value) {\n  return typeof value === 'function';\n};\nvar objectHasFunction = function objectHasFunction(data) {\n  for (var key in data) {\n    if (isFunction(data[key])) {\n      return true;\n    }\n  }\n  return false;\n};\n\n/**\r\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\r\n *\r\n * @remarks\r\n *\r\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\r\n *\r\n * @example\r\n * ```tsx\r\n * const { watch } = useForm();\r\n * const values = useWatch({\r\n *   name: \"fieldName\"\r\n *   control,\r\n * })\r\n * ```\r\n */\nfunction useWatch(props) {\n  var methods = useFormContext();\n  var _ref2 = props || {},\n    _ref2$control = _ref2.control,\n    control = _ref2$control === void 0 ? methods.control : _ref2$control,\n    name = _ref2.name,\n    defaultValue = _ref2.defaultValue,\n    disabled = _ref2.disabled,\n    exact = _ref2.exact;\n  var _name = React.useRef(name);\n  _name.current = name;\n  useSubscribe({\n    disabled: disabled,\n    subject: control._subjects.watch,\n    callback: React.useCallback(function (formState) {\n      if (shouldSubscribeByName(_name.current, formState.name, exact)) {\n        var fieldValues = generateWatchOutput(_name.current, control._names, formState.values || control._formValues);\n        updateValue(isUndefined(_name.current) || isObject(fieldValues) && !objectHasFunction(fieldValues) ? _objectSpread({}, fieldValues) : Array.isArray(fieldValues) ? _toConsumableArray(fieldValues) : isUndefined(fieldValues) ? defaultValue : fieldValues);\n      }\n    }, [control, exact, defaultValue])\n  });\n  var _React$useState3 = React.useState(isUndefined(defaultValue) ? control._getWatch(name) : defaultValue),\n    _React$useState4 = _slicedToArray(_React$useState3, 2),\n    value = _React$useState4[0],\n    updateValue = _React$useState4[1];\n  React.useEffect(function () {\n    return control._removeUnmounted();\n  });\n  return value;\n}\n\n/**\r\n * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.\r\n *\r\n * @remarks\r\n * [API](https://react-hook-form.com/api/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)\r\n *\r\n * @param props - the path name to the form field value, and validation rules.\r\n *\r\n * @returns field properties, field and form state. {@link UseControllerReturn}\r\n *\r\n * @example\r\n * ```tsx\r\n * function Input(props) {\r\n *   const { field, fieldState, formState } = useController(props);\r\n *   return (\r\n *     <div>\r\n *       <input {...field} placeholder={props.name} />\r\n *       <p>{fieldState.isTouched && \"Touched\"}</p>\r\n *       <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\r\n *     </div>\r\n *   );\r\n * }\r\n * ```\r\n */\nfunction useController(props) {\n  var methods = useFormContext();\n  var name = props.name,\n    _props$control = props.control,\n    control = _props$control === void 0 ? methods.control : _props$control,\n    shouldUnregister = props.shouldUnregister;\n  var isArrayField = isNameInFieldArray(control._names.array, name);\n  var value = useWatch({\n    control: control,\n    name: name,\n    defaultValue: _get(control._formValues, name, _get(control._defaultValues, name, props.defaultValue)),\n    exact: true\n  });\n  var formState = useFormState({\n    control: control,\n    name: name\n  });\n  var _registerProps = React.useRef(control.register(name, _objectSpread(_objectSpread({}, props.rules), {}, {\n    value: value\n  })));\n  React.useEffect(function () {\n    var updateMounted = function updateMounted(name, value) {\n      var field = _get(control._fields, name);\n      if (field) {\n        field._f.mount = value;\n      }\n    };\n    updateMounted(name, true);\n    return function () {\n      var _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;\n      (isArrayField ? _shouldUnregisterField && !control._stateFlags.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);\n    };\n  }, [name, control, isArrayField, shouldUnregister]);\n  return {\n    field: {\n      name: name,\n      value: value,\n      onChange: React.useCallback(function (event) {\n        return _registerProps.current.onChange({\n          target: {\n            value: getEventValue(event),\n            name: name\n          },\n          type: EVENTS.CHANGE\n        });\n      }, [name]),\n      onBlur: React.useCallback(function () {\n        return _registerProps.current.onBlur({\n          target: {\n            value: _get(control._formValues, name),\n            name: name\n          },\n          type: EVENTS.BLUR\n        });\n      }, [name, control]),\n      ref: function ref(elm) {\n        var field = _get(control._fields, name);\n        if (field && elm) {\n          field._f.ref = {\n            focus: function focus() {\n              return elm.focus();\n            },\n            select: function select() {\n              return elm.select();\n            },\n            setCustomValidity: function setCustomValidity(message) {\n              return elm.setCustomValidity(message);\n            },\n            reportValidity: function reportValidity() {\n              return elm.reportValidity();\n            }\n          };\n        }\n      }\n    },\n    formState: formState,\n    fieldState: Object.defineProperties({}, {\n      invalid: {\n        enumerable: true,\n        get: function get() {\n          return !!_get(formState.errors, name);\n        }\n      },\n      isDirty: {\n        enumerable: true,\n        get: function get() {\n          return !!_get(formState.dirtyFields, name);\n        }\n      },\n      isTouched: {\n        enumerable: true,\n        get: function get() {\n          return !!_get(formState.touchedFields, name);\n        }\n      },\n      error: {\n        enumerable: true,\n        get: function get() {\n          return _get(formState.errors, name);\n        }\n      }\n    })\n  };\n}\n\n/**\r\n * Component based on `useController` hook to work with controlled component.\r\n *\r\n * @remarks\r\n * [API](https://react-hook-form.com/api/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA)\r\n *\r\n * @param props - the path name to the form field value, and validation rules.\r\n *\r\n * @returns provide field handler functions, field and form state.\r\n *\r\n * @example\r\n * ```tsx\r\n * function App() {\r\n *   const { control } = useForm<FormValues>({\r\n *     defaultValues: {\r\n *       test: \"\"\r\n *     }\r\n *   });\r\n *\r\n *   return (\r\n *     <form>\r\n *       <Controller\r\n *         control={control}\r\n *         name=\"test\"\r\n *         render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (\r\n *           <>\r\n *             <input\r\n *               onChange={onChange} // send value to hook form\r\n *               onBlur={onBlur} // notify when input is touched\r\n *               value={value} // return updated value\r\n *               ref={ref} // set ref for focus management\r\n *             />\r\n *             <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\r\n *             <p>{fieldState.isTouched ? \"touched\" : \"\"}</p>\r\n *           </>\r\n *         )}\r\n *       />\r\n *     </form>\r\n *   );\r\n * }\r\n * ```\r\n */\nvar Controller = function Controller(props) {\n  return props.render(useController(props));\n};\nvar appendErrors = function appendErrors(name, validateAllFieldCriteria, errors, type, message) {\n  return validateAllFieldCriteria ? _objectSpread(_objectSpread({}, errors[name]), {}, {\n    types: _objectSpread(_objectSpread({}, errors[name] && errors[name].types ? errors[name].types : {}), {}, _defineProperty({}, type, message || true))\n  }) : {};\n};\nvar isKey = function isKey(value) {\n  return /^\\w*$/.test(value);\n};\nvar stringToPath = function stringToPath(input) {\n  return compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n};\nfunction set(object, path, value) {\n  var index = -1;\n  var tempPath = isKey(path) ? [path] : stringToPath(path);\n  var length = tempPath.length;\n  var lastIndex = length - 1;\n  while (++index < length) {\n    var key = tempPath[index];\n    var newValue = value;\n    if (index !== lastIndex) {\n      var objValue = object[key];\n      newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};\n    }\n    object[key] = newValue;\n    object = object[key];\n  }\n  return object;\n}\nvar focusFieldBy = function focusFieldBy(fields, callback, fieldsNames) {\n  var _iterator = _createForOfIteratorHelper(fieldsNames || Object.keys(fields)),\n    _step;\n  try {\n    for (_iterator.s(); !(_step = _iterator.n()).done;) {\n      var key = _step.value;\n      var field = _get(fields, key);\n      if (field) {\n        var _f = field._f,\n          currentField = _objectWithoutProperties(field, _excluded3);\n        if (_f && callback(_f.name)) {\n          if (_f.ref.focus) {\n            _f.ref.focus();\n            break;\n          } else if (_f.refs && _f.refs[0].focus) {\n            _f.refs[0].focus();\n            break;\n          }\n        } else if (isObject(currentField)) {\n          focusFieldBy(currentField, callback);\n        }\n      }\n    }\n  } catch (err) {\n    _iterator.e(err);\n  } finally {\n    _iterator.f();\n  }\n};\nvar generateId = function generateId() {\n  var d = typeof performance === 'undefined' ? Date.now() : performance.now() * 1000;\n  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n    var r = (Math.random() * 16 + d) % 16 | 0;\n    return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n  });\n};\nvar getFocusFieldName = function getFocusFieldName(name, index) {\n  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n  return options.shouldFocus || isUndefined(options.shouldFocus) ? options.focusName || \"\".concat(name, \".\").concat(isUndefined(options.focusIndex) ? index : options.focusIndex, \".\") : '';\n};\nvar isWatched = function isWatched(name, _names, isBlurEvent) {\n  return !isBlurEvent && (_names.watchAll || _names.watch.has(name) || _toConsumableArray(_names.watch).some(function (watchName) {\n    return name.startsWith(watchName) && /^\\.\\w+/.test(name.slice(watchName.length));\n  }));\n};\nvar updateFieldArrayRootError = function updateFieldArrayRootError(errors, error, name) {\n  var fieldArrayErrors = compact(_get(errors, name));\n  set(fieldArrayErrors, 'root', error[name]);\n  set(errors, name, fieldArrayErrors);\n  return errors;\n};\nvar isBoolean = function isBoolean(value) {\n  return typeof value === 'boolean';\n};\nvar isFileInput = function isFileInput(element) {\n  return element.type === 'file';\n};\nvar isMessage = function isMessage(value) {\n  return isString(value) || React.isValidElement(value);\n};\nvar isRadioInput = function isRadioInput(element) {\n  return element.type === 'radio';\n};\nvar isRegex = function isRegex(value) {\n  return value instanceof RegExp;\n};\nvar defaultResult = {\n  value: false,\n  isValid: false\n};\nvar validResult = {\n  value: true,\n  isValid: true\n};\nvar getCheckboxValue = function getCheckboxValue(options) {\n  if (Array.isArray(options)) {\n    if (options.length > 1) {\n      var values = options.filter(function (option) {\n        return option && option.checked && !option.disabled;\n      }).map(function (option) {\n        return option.value;\n      });\n      return {\n        value: values,\n        isValid: !!values.length\n      };\n    }\n    return options[0].checked && !options[0].disabled ?\n    // @ts-expect-error expected to work in the browser\n    options[0].attributes && !isUndefined(options[0].attributes.value) ? isUndefined(options[0].value) || options[0].value === '' ? validResult : {\n      value: options[0].value,\n      isValid: true\n    } : validResult : defaultResult;\n  }\n  return defaultResult;\n};\nvar defaultReturn = {\n  isValid: false,\n  value: null\n};\nvar getRadioValue = function getRadioValue(options) {\n  return Array.isArray(options) ? options.reduce(function (previous, option) {\n    return option && option.checked && !option.disabled ? {\n      isValid: true,\n      value: option.value\n    } : previous;\n  }, defaultReturn) : defaultReturn;\n};\nfunction getValidateError(result, ref) {\n  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'validate';\n  if (isMessage(result) || Array.isArray(result) && result.every(isMessage) || isBoolean(result) && !result) {\n    return {\n      type: type,\n      message: isMessage(result) ? result : '',\n      ref: ref\n    };\n  }\n}\nvar getValueAndMessage = function getValueAndMessage(validationData) {\n  return isObject(validationData) && !isRegex(validationData) ? validationData : {\n    value: validationData,\n    message: ''\n  };\n};\nvar validateField = /*#__PURE__*/function () {\n  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(field, inputValue, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {\n    var _field$_f, ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, disabled, inputRef, setCustomValidity, error, isRadio, isCheckBox, isRadioOrCheckbox, isEmpty, appendErrorsCurry, getMinMaxMessage, _ref4, value, message, exceedMax, exceedMin, maxOutput, minOutput, valueNumber, valueDate, convertTimeToDate, isTime, isWeek, maxLengthOutput, minLengthOutput, _exceedMax, _exceedMin, _getValueAndMessage, patternValue, _message, result, validateError, validationResult, key, _validateError;\n    return _regeneratorRuntime().wrap(function _callee$(_context) {\n      while (1) {\n        switch (_context.prev = _context.next) {\n          case 0:\n            _field$_f = field._f, ref = _field$_f.ref, refs = _field$_f.refs, required = _field$_f.required, maxLength = _field$_f.maxLength, minLength = _field$_f.minLength, min = _field$_f.min, max = _field$_f.max, pattern = _field$_f.pattern, validate = _field$_f.validate, name = _field$_f.name, valueAsNumber = _field$_f.valueAsNumber, mount = _field$_f.mount, disabled = _field$_f.disabled;\n            if (!(!mount || disabled)) {\n              _context.next = 3;\n              break;\n            }\n            return _context.abrupt(\"return\", {});\n          case 3:\n            inputRef = refs ? refs[0] : ref;\n            setCustomValidity = function setCustomValidity(message) {\n              if (shouldUseNativeValidation && inputRef.reportValidity) {\n                inputRef.setCustomValidity(isBoolean(message) ? '' : message || ' ');\n                inputRef.reportValidity();\n              }\n            };\n            error = {};\n            isRadio = isRadioInput(ref);\n            isCheckBox = isCheckBoxInput(ref);\n            isRadioOrCheckbox = isRadio || isCheckBox;\n            isEmpty = (valueAsNumber || isFileInput(ref)) && !ref.value || inputValue === '' || Array.isArray(inputValue) && !inputValue.length;\n            appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);\n            getMinMaxMessage = function getMinMaxMessage(exceedMax, maxLengthMessage, minLengthMessage) {\n              var maxType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : INPUT_VALIDATION_RULES.maxLength;\n              var minType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : INPUT_VALIDATION_RULES.minLength;\n              var message = exceedMax ? maxLengthMessage : minLengthMessage;\n              error[name] = _objectSpread({\n                type: exceedMax ? maxType : minType,\n                message: message,\n                ref: ref\n              }, appendErrorsCurry(exceedMax ? maxType : minType, message));\n            };\n            if (!(isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid))) {\n              _context.next = 19;\n              break;\n            }\n            _ref4 = isMessage(required) ? {\n              value: !!required,\n              message: required\n            } : getValueAndMessage(required), value = _ref4.value, message = _ref4.message;\n            if (!value) {\n              _context.next = 19;\n              break;\n            }\n            error[name] = _objectSpread({\n              type: INPUT_VALIDATION_RULES.required,\n              message: message,\n              ref: inputRef\n            }, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));\n            if (validateAllFieldCriteria) {\n              _context.next = 19;\n              break;\n            }\n            setCustomValidity(message);\n            return _context.abrupt(\"return\", error);\n          case 19:\n            if (!(!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max)))) {\n              _context.next = 28;\n              break;\n            }\n            maxOutput = getValueAndMessage(max);\n            minOutput = getValueAndMessage(min);\n            if (!isNullOrUndefined(inputValue) && !isNaN(inputValue)) {\n              valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue);\n              if (!isNullOrUndefined(maxOutput.value)) {\n                exceedMax = valueNumber > maxOutput.value;\n              }\n              if (!isNullOrUndefined(minOutput.value)) {\n                exceedMin = valueNumber < minOutput.value;\n              }\n            } else {\n              valueDate = ref.valueAsDate || new Date(inputValue);\n              convertTimeToDate = function convertTimeToDate(time) {\n                return new Date(new Date().toDateString() + ' ' + time);\n              };\n              isTime = ref.type == 'time';\n              isWeek = ref.type == 'week';\n              if (isString(maxOutput.value) && inputValue) {\n                exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value);\n              }\n              if (isString(minOutput.value) && inputValue) {\n                exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value);\n              }\n            }\n            if (!(exceedMax || exceedMin)) {\n              _context.next = 28;\n              break;\n            }\n            getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);\n            if (validateAllFieldCriteria) {\n              _context.next = 28;\n              break;\n            }\n            setCustomValidity(error[name].message);\n            return _context.abrupt(\"return\", error);\n          case 28:\n            if (!((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue)))) {\n              _context.next = 38;\n              break;\n            }\n            maxLengthOutput = getValueAndMessage(maxLength);\n            minLengthOutput = getValueAndMessage(minLength);\n            _exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > maxLengthOutput.value;\n            _exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < minLengthOutput.value;\n            if (!(_exceedMax || _exceedMin)) {\n              _context.next = 38;\n              break;\n            }\n            getMinMaxMessage(_exceedMax, maxLengthOutput.message, minLengthOutput.message);\n            if (validateAllFieldCriteria) {\n              _context.next = 38;\n              break;\n            }\n            setCustomValidity(error[name].message);\n            return _context.abrupt(\"return\", error);\n          case 38:\n            if (!(pattern && !isEmpty && isString(inputValue))) {\n              _context.next = 45;\n              break;\n            }\n            _getValueAndMessage = getValueAndMessage(pattern), patternValue = _getValueAndMessage.value, _message = _getValueAndMessage.message;\n            if (!(isRegex(patternValue) && !inputValue.match(patternValue))) {\n              _context.next = 45;\n              break;\n            }\n            error[name] = _objectSpread({\n              type: INPUT_VALIDATION_RULES.pattern,\n              message: _message,\n              ref: ref\n            }, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, _message));\n            if (validateAllFieldCriteria) {\n              _context.next = 45;\n              break;\n            }\n            setCustomValidity(_message);\n            return _context.abrupt(\"return\", error);\n          case 45:\n            if (!validate) {\n              _context.next = 79;\n              break;\n            }\n            if (!isFunction(validate)) {\n              _context.next = 58;\n              break;\n            }\n            _context.next = 49;\n            return validate(inputValue);\n          case 49:\n            result = _context.sent;\n            validateError = getValidateError(result, inputRef);\n            if (!validateError) {\n              _context.next = 56;\n              break;\n            }\n            error[name] = _objectSpread(_objectSpread({}, validateError), appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));\n            if (validateAllFieldCriteria) {\n              _context.next = 56;\n              break;\n            }\n            setCustomValidity(validateError.message);\n            return _context.abrupt(\"return\", error);\n          case 56:\n            _context.next = 79;\n            break;\n          case 58:\n            if (!isObject(validate)) {\n              _context.next = 79;\n              break;\n            }\n            validationResult = {};\n            _context.t0 = _regeneratorRuntime().keys(validate);\n          case 61:\n            if ((_context.t1 = _context.t0()).done) {\n              _context.next = 75;\n              break;\n            }\n            key = _context.t1.value;\n            if (!(!isEmptyObject(validationResult) && !validateAllFieldCriteria)) {\n              _context.next = 65;\n              break;\n            }\n            return _context.abrupt(\"break\", 75);\n          case 65:\n            _context.t2 = getValidateError;\n            _context.next = 68;\n            return validate[key](inputValue);\n          case 68:\n            _context.t3 = _context.sent;\n            _context.t4 = inputRef;\n            _context.t5 = key;\n            _validateError = (0, _context.t2)(_context.t3, _context.t4, _context.t5);\n            if (_validateError) {\n              validationResult = _objectSpread(_objectSpread({}, _validateError), appendErrorsCurry(key, _validateError.message));\n              setCustomValidity(_validateError.message);\n              if (validateAllFieldCriteria) {\n                error[name] = validationResult;\n              }\n            }\n            _context.next = 61;\n            break;\n          case 75:\n            if (isEmptyObject(validationResult)) {\n              _context.next = 79;\n              break;\n            }\n            error[name] = _objectSpread({\n              ref: inputRef\n            }, validationResult);\n            if (validateAllFieldCriteria) {\n              _context.next = 79;\n              break;\n            }\n            return _context.abrupt(\"return\", error);\n          case 79:\n            setCustomValidity(true);\n            return _context.abrupt(\"return\", error);\n          case 81:\n          case \"end\":\n            return _context.stop();\n        }\n      }\n    }, _callee);\n  }));\n  return function validateField(_x, _x2, _x3, _x4, _x5) {\n    return _ref3.apply(this, arguments);\n  };\n}();\nfunction append(data, value) {\n  return [].concat(_toConsumableArray(data), _toConsumableArray(convertToArrayPayload(value)));\n}\nvar isPlainObject = function isPlainObject(tempObject) {\n  var prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;\n  return isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf');\n};\nvar isWeb = typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined' && typeof document !== 'undefined';\nfunction cloneObject(data) {\n  var copy;\n  var isArray = Array.isArray(data);\n  if (data instanceof Date) {\n    copy = new Date(data);\n  } else if (data instanceof Set) {\n    copy = new Set(data);\n  } else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray || isObject(data))) {\n    copy = isArray ? [] : {};\n    if (!Array.isArray(data) && !isPlainObject(data)) {\n      copy = data;\n    } else {\n      for (var key in data) {\n        copy[key] = cloneObject(data[key]);\n      }\n    }\n  } else {\n    return data;\n  }\n  return copy;\n}\nvar fillEmptyArray = function fillEmptyArray(value) {\n  return Array.isArray(value) ? value.map(function () {\n    return undefined;\n  }) : undefined;\n};\nvar getValidationModes = function getValidationModes(mode) {\n  return {\n    isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\n    isOnBlur: mode === VALIDATION_MODE.onBlur,\n    isOnChange: mode === VALIDATION_MODE.onChange,\n    isOnAll: mode === VALIDATION_MODE.all,\n    isOnTouch: mode === VALIDATION_MODE.onTouched\n  };\n};\nfunction insert(data, index, value) {\n  return [].concat(_toConsumableArray(data.slice(0, index)), _toConsumableArray(convertToArrayPayload(value)), _toConsumableArray(data.slice(index)));\n}\nvar moveArrayAt = function moveArrayAt(data, from, to) {\n  if (!Array.isArray(data)) {\n    return [];\n  }\n  if (isUndefined(data[to])) {\n    data[to] = undefined;\n  }\n  data.splice(to, 0, data.splice(from, 1)[0]);\n  return data;\n};\nfunction prepend(data, value) {\n  return [].concat(_toConsumableArray(convertToArrayPayload(value)), _toConsumableArray(convertToArrayPayload(data)));\n}\nfunction removeAtIndexes(data, indexes) {\n  var i = 0;\n  var temp = _toConsumableArray(data);\n  var _iterator2 = _createForOfIteratorHelper(indexes),\n    _step2;\n  try {\n    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n      var index = _step2.value;\n      temp.splice(index - i, 1);\n      i++;\n    }\n  } catch (err) {\n    _iterator2.e(err);\n  } finally {\n    _iterator2.f();\n  }\n  return compact(temp).length ? temp : [];\n}\nvar removeArrayAt = function removeArrayAt(data, index) {\n  return isUndefined(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort(function (a, b) {\n    return a - b;\n  }));\n};\nvar swapArrayAt = function swapArrayAt(data, indexA, indexB) {\n  data[indexA] = [data[indexB], data[indexB] = data[indexA]][0];\n};\nfunction baseGet(object, updatePath) {\n  var length = updatePath.slice(0, -1).length;\n  var index = 0;\n  while (index < length) {\n    object = isUndefined(object) ? index++ : object[updatePath[index++]];\n  }\n  return object;\n}\nfunction isEmptyArray(obj) {\n  for (var key in obj) {\n    if (!isUndefined(obj[key])) {\n      return false;\n    }\n  }\n  return true;\n}\nfunction unset(object, path) {\n  var updatePath = isKey(path) ? [path] : stringToPath(path);\n  var childObject = updatePath.length == 1 ? object : baseGet(object, updatePath);\n  var key = updatePath[updatePath.length - 1];\n  var previousObjRef;\n  if (childObject) {\n    delete childObject[key];\n  }\n  for (var k = 0; k < updatePath.slice(0, -1).length; k++) {\n    var index = -1;\n    var objectRef = void 0;\n    var currentPaths = updatePath.slice(0, -(k + 1));\n    var currentPathsLength = currentPaths.length - 1;\n    if (k > 0) {\n      previousObjRef = object;\n    }\n    while (++index < currentPaths.length) {\n      var item = currentPaths[index];\n      objectRef = objectRef ? objectRef[item] : object[item];\n      if (currentPathsLength === index && (isObject(objectRef) && isEmptyObject(objectRef) || Array.isArray(objectRef) && isEmptyArray(objectRef))) {\n        previousObjRef ? delete previousObjRef[item] : delete object[item];\n      }\n      previousObjRef = objectRef;\n    }\n  }\n  return object;\n}\nvar updateAt = function updateAt(fieldValues, index, value) {\n  fieldValues[index] = value;\n  return fieldValues;\n};\n\n/**\r\n * A custom hook that exposes convenient methods to perform operations with a list of dynamic inputs that need to be appended, updated, removed etc. • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn) • [Video](https://youtu.be/4MrbfGSFY2A)\r\n *\r\n * @remarks\r\n * [API](https://react-hook-form.com/api/usefieldarray) • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn)\r\n *\r\n * @param props - useFieldArray props\r\n *\r\n * @returns methods - functions to manipulate with the Field Arrays (dynamic inputs) {@link UseFieldArrayReturn}\r\n *\r\n * @example\r\n * ```tsx\r\n * function App() {\r\n *   const { register, control, handleSubmit, reset, trigger, setError } = useForm({\r\n *     defaultValues: {\r\n *       test: []\r\n *     }\r\n *   });\r\n *   const { fields, append } = useFieldArray({\r\n *     control,\r\n *     name: \"test\"\r\n *   });\r\n *\r\n *   return (\r\n *     <form onSubmit={handleSubmit(data => console.log(data))}>\r\n *       {fields.map((item, index) => (\r\n *          <input key={item.id} {...register(`test.${index}.firstName`)}  />\r\n *       ))}\r\n *       <button type=\"button\" onClick={() => append({ firstName: \"bill\" })}>\r\n *         append\r\n *       </button>\r\n *       <input type=\"submit\" />\r\n *     </form>\r\n *   );\r\n * }\r\n * ```\r\n */\nfunction useFieldArray(props) {\n  var methods = useFormContext();\n  var _props$control2 = props.control,\n    control = _props$control2 === void 0 ? methods.control : _props$control2,\n    name = props.name,\n    _props$keyName = props.keyName,\n    keyName = _props$keyName === void 0 ? 'id' : _props$keyName,\n    shouldUnregister = props.shouldUnregister;\n  var _React$useState5 = React.useState(control._getFieldArray(name)),\n    _React$useState6 = _slicedToArray(_React$useState5, 2),\n    fields = _React$useState6[0],\n    setFields = _React$useState6[1];\n  var ids = React.useRef(control._getFieldArray(name).map(generateId));\n  var _fieldIds = React.useRef(fields);\n  var _name = React.useRef(name);\n  var _actioned = React.useRef(false);\n  _name.current = name;\n  _fieldIds.current = fields;\n  control._names.array.add(name);\n  props.rules && control.register(name, props.rules);\n  var callback = React.useCallback(function (_ref5) {\n    var values = _ref5.values,\n      fieldArrayName = _ref5.name;\n    if (fieldArrayName === _name.current || !fieldArrayName) {\n      var fieldValues = _get(values, _name.current);\n      if (Array.isArray(fieldValues)) {\n        setFields(fieldValues);\n        ids.current = fieldValues.map(generateId);\n      }\n    }\n  }, []);\n  useSubscribe({\n    callback: callback,\n    subject: control._subjects.array\n  });\n  var updateValues = React.useCallback(function (updatedFieldArrayValues) {\n    _actioned.current = true;\n    control._updateFieldArray(name, updatedFieldArrayValues);\n  }, [control, name]);\n  var append$1 = function append$1(value, options) {\n    var appendValue = convertToArrayPayload(cloneObject(value));\n    var updatedFieldArrayValues = append(control._getFieldArray(name), appendValue);\n    control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);\n    ids.current = append(ids.current, appendValue.map(generateId));\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, append, {\n      argA: fillEmptyArray(value)\n    });\n  };\n  var prepend$1 = function prepend$1(value, options) {\n    var prependValue = convertToArrayPayload(cloneObject(value));\n    var updatedFieldArrayValues = prepend(control._getFieldArray(name), prependValue);\n    control._names.focus = getFocusFieldName(name, 0, options);\n    ids.current = prepend(ids.current, prependValue.map(generateId));\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, prepend, {\n      argA: fillEmptyArray(value)\n    });\n  };\n  var remove = function remove(index) {\n    var updatedFieldArrayValues = removeArrayAt(control._getFieldArray(name), index);\n    ids.current = removeArrayAt(ids.current, index);\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, removeArrayAt, {\n      argA: index\n    });\n  };\n  var insert$1 = function insert$1(index, value, options) {\n    var insertValue = convertToArrayPayload(cloneObject(value));\n    var updatedFieldArrayValues = insert(control._getFieldArray(name), index, insertValue);\n    control._names.focus = getFocusFieldName(name, index, options);\n    ids.current = insert(ids.current, index, insertValue.map(generateId));\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, insert, {\n      argA: index,\n      argB: fillEmptyArray(value)\n    });\n  };\n  var swap = function swap(indexA, indexB) {\n    var updatedFieldArrayValues = control._getFieldArray(name);\n    swapArrayAt(updatedFieldArrayValues, indexA, indexB);\n    swapArrayAt(ids.current, indexA, indexB);\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, swapArrayAt, {\n      argA: indexA,\n      argB: indexB\n    }, false);\n  };\n  var move = function move(from, to) {\n    var updatedFieldArrayValues = control._getFieldArray(name);\n    moveArrayAt(updatedFieldArrayValues, from, to);\n    moveArrayAt(ids.current, from, to);\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, moveArrayAt, {\n      argA: from,\n      argB: to\n    }, false);\n  };\n  var update = function update(index, value) {\n    var updateValue = cloneObject(value);\n    var updatedFieldArrayValues = updateAt(control._getFieldArray(name), index, updateValue);\n    ids.current = _toConsumableArray(updatedFieldArrayValues).map(function (item, i) {\n      return !item || i === index ? generateId() : ids.current[i];\n    });\n    updateValues(updatedFieldArrayValues);\n    setFields(_toConsumableArray(updatedFieldArrayValues));\n    control._updateFieldArray(name, updatedFieldArrayValues, updateAt, {\n      argA: index,\n      argB: updateValue\n    }, true, false);\n  };\n  var replace = function replace(value) {\n    var updatedFieldArrayValues = convertToArrayPayload(cloneObject(value));\n    ids.current = updatedFieldArrayValues.map(generateId);\n    updateValues(_toConsumableArray(updatedFieldArrayValues));\n    setFields(_toConsumableArray(updatedFieldArrayValues));\n    control._updateFieldArray(name, _toConsumableArray(updatedFieldArrayValues), function (data) {\n      return data;\n    }, {}, true, false);\n  };\n  React.useEffect(function () {\n    control._stateFlags.action = false;\n    isWatched(name, control._names) && control._subjects.state.next({});\n    if (_actioned.current && (!getValidationModes(control._options.mode).isOnSubmit || control._formState.isSubmitted)) {\n      if (control._options.resolver) {\n        control._executeSchema([name]).then(function (result) {\n          var error = _get(result.errors, name);\n          var existingError = _get(control._formState.errors, name);\n          if (existingError ? !error && existingError.type : error && error.type) {\n            error ? set(control._formState.errors, name, error) : unset(control._formState.errors, name);\n            control._subjects.state.next({\n              errors: control._formState.errors\n            });\n          }\n        });\n      } else {\n        var field = _get(control._fields, name);\n        if (field && field._f) {\n          validateField(field, _get(control._formValues, name), control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then(function (error) {\n            return !isEmptyObject(error) && control._subjects.state.next({\n              errors: updateFieldArrayRootError(control._formState.errors, error, name)\n            });\n          });\n        }\n      }\n    }\n    control._subjects.watch.next({\n      name: name,\n      values: control._formValues\n    });\n    control._names.focus && focusFieldBy(control._fields, function (key) {\n      return !!key && key.startsWith(control._names.focus);\n    });\n    control._names.focus = '';\n    control._proxyFormState.isValid && control._updateValid();\n  }, [fields, name, control]);\n  React.useEffect(function () {\n    !_get(control._formValues, name) && control._updateFieldArray(name);\n    return function () {\n      (control._options.shouldUnregister || shouldUnregister) && control.unregister(name);\n    };\n  }, [name, control, keyName, shouldUnregister]);\n  return {\n    swap: React.useCallback(swap, [updateValues, name, control]),\n    move: React.useCallback(move, [updateValues, name, control]),\n    prepend: React.useCallback(prepend$1, [updateValues, name, control]),\n    append: React.useCallback(append$1, [updateValues, name, control]),\n    remove: React.useCallback(remove, [updateValues, name, control]),\n    insert: React.useCallback(insert$1, [updateValues, name, control]),\n    update: React.useCallback(update, [updateValues, name, control]),\n    replace: React.useCallback(replace, [updateValues, name, control]),\n    fields: React.useMemo(function () {\n      return fields.map(function (field, index) {\n        return _objectSpread(_objectSpread({}, field), {}, _defineProperty({}, keyName, ids.current[index] || generateId()));\n      });\n    }, [fields, keyName])\n  };\n}\nfunction createSubject() {\n  var _observers = [];\n  var next = function next(value) {\n    var _iterator3 = _createForOfIteratorHelper(_observers),\n      _step3;\n    try {\n      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n        var observer = _step3.value;\n        observer.next(value);\n      }\n    } catch (err) {\n      _iterator3.e(err);\n    } finally {\n      _iterator3.f();\n    }\n  };\n  var subscribe = function subscribe(observer) {\n    _observers.push(observer);\n    return {\n      unsubscribe: function unsubscribe() {\n        _observers = _observers.filter(function (o) {\n          return o !== observer;\n        });\n      }\n    };\n  };\n  var unsubscribe = function unsubscribe() {\n    _observers = [];\n  };\n  return {\n    get observers() {\n      return _observers;\n    },\n    next: next,\n    subscribe: subscribe,\n    unsubscribe: unsubscribe\n  };\n}\nvar isPrimitive = function isPrimitive(value) {\n  return isNullOrUndefined(value) || !isObjectType(value);\n};\nfunction deepEqual(object1, object2) {\n  if (isPrimitive(object1) || isPrimitive(object2)) {\n    return object1 === object2;\n  }\n  if (isDateObject(object1) && isDateObject(object2)) {\n    return object1.getTime() === object2.getTime();\n  }\n  var keys1 = Object.keys(object1);\n  var keys2 = Object.keys(object2);\n  if (keys1.length !== keys2.length) {\n    return false;\n  }\n  for (var _i = 0, _keys = keys1; _i < _keys.length; _i++) {\n    var key = _keys[_i];\n    var val1 = object1[key];\n    if (!keys2.includes(key)) {\n      return false;\n    }\n    if (key !== 'ref') {\n      var val2 = object2[key];\n      if (isDateObject(val1) && isDateObject(val2) || isObject(val1) && isObject(val2) || Array.isArray(val1) && Array.isArray(val2) ? !deepEqual(val1, val2) : val1 !== val2) {\n        return false;\n      }\n    }\n  }\n  return true;\n}\nvar isHTMLElement = function isHTMLElement(value) {\n  var owner = value ? value.ownerDocument : 0;\n  var ElementClass = owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement;\n  return value instanceof ElementClass;\n};\nvar isMultipleSelect = function isMultipleSelect(element) {\n  return element.type === \"select-multiple\";\n};\nvar isRadioOrCheckbox = function isRadioOrCheckbox(ref) {\n  return isRadioInput(ref) || isCheckBoxInput(ref);\n};\nvar live = function live(ref) {\n  return isHTMLElement(ref) && ref.isConnected;\n};\nfunction markFieldsDirty(data) {\n  var fields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n  var isParentNodeArray = Array.isArray(data);\n  if (isObject(data) || isParentNodeArray) {\n    for (var key in data) {\n      if (Array.isArray(data[key]) || isObject(data[key]) && !objectHasFunction(data[key])) {\n        fields[key] = Array.isArray(data[key]) ? [] : {};\n        markFieldsDirty(data[key], fields[key]);\n      } else if (!isNullOrUndefined(data[key])) {\n        fields[key] = true;\n      }\n    }\n  }\n  return fields;\n}\nfunction getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues) {\n  var isParentNodeArray = Array.isArray(data);\n  if (isObject(data) || isParentNodeArray) {\n    for (var key in data) {\n      if (Array.isArray(data[key]) || isObject(data[key]) && !objectHasFunction(data[key])) {\n        if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) {\n          dirtyFieldsFromValues[key] = Array.isArray(data[key]) ? markFieldsDirty(data[key], []) : _objectSpread({}, markFieldsDirty(data[key]));\n        } else {\n          getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);\n        }\n      } else {\n        dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);\n      }\n    }\n  }\n  return dirtyFieldsFromValues;\n}\nvar getDirtyFields = function getDirtyFields(defaultValues, formValues) {\n  return getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));\n};\nvar getFieldValueAs = function getFieldValueAs(value, _ref6) {\n  var valueAsNumber = _ref6.valueAsNumber,\n    valueAsDate = _ref6.valueAsDate,\n    setValueAs = _ref6.setValueAs;\n  return isUndefined(value) ? value : valueAsNumber ? value === '' ? NaN : value ? +value : value : valueAsDate && isString(value) ? new Date(value) : setValueAs ? setValueAs(value) : value;\n};\nfunction getFieldValue(_f) {\n  var ref = _f.ref;\n  if (_f.refs ? _f.refs.every(function (ref) {\n    return ref.disabled;\n  }) : ref.disabled) {\n    return;\n  }\n  if (isFileInput(ref)) {\n    return ref.files;\n  }\n  if (isRadioInput(ref)) {\n    return getRadioValue(_f.refs).value;\n  }\n  if (isMultipleSelect(ref)) {\n    return _toConsumableArray(ref.selectedOptions).map(function (_ref7) {\n      var value = _ref7.value;\n      return value;\n    });\n  }\n  if (isCheckBoxInput(ref)) {\n    return getCheckboxValue(_f.refs).value;\n  }\n  return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);\n}\nvar getResolverOptions = function getResolverOptions(fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) {\n  var fields = {};\n  var _iterator4 = _createForOfIteratorHelper(fieldsNames),\n    _step4;\n  try {\n    for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n      var _name2 = _step4.value;\n      var field = _get(_fields, _name2);\n      field && set(fields, _name2, field._f);\n    }\n  } catch (err) {\n    _iterator4.e(err);\n  } finally {\n    _iterator4.f();\n  }\n  return {\n    criteriaMode: criteriaMode,\n    names: _toConsumableArray(fieldsNames),\n    fields: fields,\n    shouldUseNativeValidation: shouldUseNativeValidation\n  };\n};\nvar getRuleValue = function getRuleValue(rule) {\n  return isUndefined(rule) ? undefined : isRegex(rule) ? rule.source : isObject(rule) ? isRegex(rule.value) ? rule.value.source : rule.value : rule;\n};\nvar hasValidation = function hasValidation(options) {\n  return options.mount && (options.required || options.min || options.max || options.maxLength || options.minLength || options.pattern || options.validate);\n};\nfunction schemaErrorLookup(errors, _fields, name) {\n  var error = _get(errors, name);\n  if (error || isKey(name)) {\n    return {\n      error: error,\n      name: name\n    };\n  }\n  var names = name.split('.');\n  while (names.length) {\n    var fieldName = names.join('.');\n    var field = _get(_fields, fieldName);\n    var foundError = _get(errors, fieldName);\n    if (field && !Array.isArray(field) && name !== fieldName) {\n      return {\n        name: name\n      };\n    }\n    if (foundError && foundError.type) {\n      return {\n        name: fieldName,\n        error: foundError\n      };\n    }\n    names.pop();\n  }\n  return {\n    name: name\n  };\n}\nvar skipValidation = function skipValidation(isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) {\n  if (mode.isOnAll) {\n    return false;\n  } else if (!isSubmitted && mode.isOnTouch) {\n    return !(isTouched || isBlurEvent);\n  } else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) {\n    return !isBlurEvent;\n  } else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) {\n    return isBlurEvent;\n  }\n  return true;\n};\nvar unsetEmptyArray = function unsetEmptyArray(ref, name) {\n  return !compact(_get(ref, name)).length && unset(ref, name);\n};\nvar defaultOptions = {\n  mode: VALIDATION_MODE.onSubmit,\n  reValidateMode: VALIDATION_MODE.onChange,\n  shouldFocusError: true\n};\nfunction createFormControl() {\n  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  var _options = _objectSpread(_objectSpread({}, defaultOptions), props);\n  var _formState = {\n    submitCount: 0,\n    isDirty: false,\n    isValidating: false,\n    isSubmitted: false,\n    isSubmitting: false,\n    isSubmitSuccessful: false,\n    isValid: false,\n    touchedFields: {},\n    dirtyFields: {},\n    errors: {}\n  };\n  var _fields = {};\n  var _defaultValues = cloneObject(_options.defaultValues) || {};\n  var _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);\n  var _stateFlags = {\n    action: false,\n    mount: false,\n    watch: false\n  };\n  var _names = {\n    mount: new Set(),\n    unMount: new Set(),\n    array: new Set(),\n    watch: new Set()\n  };\n  var delayErrorCallback;\n  var timer = 0;\n  var validateFields = {};\n  var _proxyFormState = {\n    isDirty: false,\n    dirtyFields: false,\n    touchedFields: false,\n    isValidating: false,\n    isValid: false,\n    errors: false\n  };\n  var _subjects = {\n    watch: createSubject(),\n    array: createSubject(),\n    state: createSubject()\n  };\n  var validationModeBeforeSubmit = getValidationModes(_options.mode);\n  var validationModeAfterSubmit = getValidationModes(_options.reValidateMode);\n  var shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;\n  var debounce = function debounce(callback) {\n    return function (wait) {\n      clearTimeout(timer);\n      timer = window.setTimeout(callback, wait);\n    };\n  };\n  var _updateValid = /*#__PURE__*/function () {\n    var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(shouldSkipRender) {\n      var isValid;\n      return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n        while (1) {\n          switch (_context2.prev = _context2.next) {\n            case 0:\n              isValid = false;\n              if (!_proxyFormState.isValid) {\n                _context2.next = 15;\n                break;\n              }\n              if (!_options.resolver) {\n                _context2.next = 10;\n                break;\n              }\n              _context2.t1 = isEmptyObject;\n              _context2.next = 6;\n              return _executeSchema();\n            case 6:\n              _context2.t2 = _context2.sent.errors;\n              _context2.t0 = (0, _context2.t1)(_context2.t2);\n              _context2.next = 13;\n              break;\n            case 10:\n              _context2.next = 12;\n              return executeBuiltInValidation(_fields, true);\n            case 12:\n              _context2.t0 = _context2.sent;\n            case 13:\n              isValid = _context2.t0;\n              if (!shouldSkipRender && isValid !== _formState.isValid) {\n                _formState.isValid = isValid;\n                _subjects.state.next({\n                  isValid: isValid\n                });\n              }\n            case 15:\n              return _context2.abrupt(\"return\", isValid);\n            case 16:\n            case \"end\":\n              return _context2.stop();\n          }\n        }\n      }, _callee2);\n    }));\n    return function _updateValid(_x6) {\n      return _ref8.apply(this, arguments);\n    };\n  }();\n  var _updateFieldArray = function _updateFieldArray(name) {\n    var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n    var method = arguments.length > 2 ? arguments[2] : undefined;\n    var args = arguments.length > 3 ? arguments[3] : undefined;\n    var shouldSetValues = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n    var shouldUpdateFieldsAndState = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;\n    if (args && method) {\n      _stateFlags.action = true;\n      if (shouldUpdateFieldsAndState && Array.isArray(_get(_fields, name))) {\n        var fieldValues = method(_get(_fields, name), args.argA, args.argB);\n        shouldSetValues && set(_fields, name, fieldValues);\n      }\n      if (_proxyFormState.errors && shouldUpdateFieldsAndState && Array.isArray(_get(_formState.errors, name))) {\n        var errors = method(_get(_formState.errors, name), args.argA, args.argB);\n        shouldSetValues && set(_formState.errors, name, errors);\n        unsetEmptyArray(_formState.errors, name);\n      }\n      if (_proxyFormState.touchedFields && shouldUpdateFieldsAndState && Array.isArray(_get(_formState.touchedFields, name))) {\n        var touchedFields = method(_get(_formState.touchedFields, name), args.argA, args.argB);\n        shouldSetValues && set(_formState.touchedFields, name, touchedFields);\n      }\n      if (_proxyFormState.dirtyFields) {\n        _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\n      }\n      _subjects.state.next({\n        isDirty: _getDirty(name, values),\n        dirtyFields: _formState.dirtyFields,\n        errors: _formState.errors,\n        isValid: _formState.isValid\n      });\n    } else {\n      set(_formValues, name, values);\n    }\n  };\n  var updateErrors = function updateErrors(name, error) {\n    set(_formState.errors, name, error);\n    _subjects.state.next({\n      errors: _formState.errors\n    });\n  };\n  var updateValidAndValue = function updateValidAndValue(name, shouldSkipSetValueAs, value, ref) {\n    var field = _get(_fields, name);\n    if (field) {\n      var defaultValue = _get(_formValues, name, isUndefined(value) ? _get(_defaultValues, name) : value);\n      isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);\n      _stateFlags.mount && _updateValid();\n    }\n  };\n  var updateTouchAndDirty = function updateTouchAndDirty(name, fieldValue, isBlurEvent, shouldDirty, shouldRender) {\n    var isFieldDirty = false;\n    var output = {\n      name: name\n    };\n    var isPreviousFieldTouched = _get(_formState.touchedFields, name);\n    if (_proxyFormState.isDirty) {\n      var isPreviousFormDirty = _formState.isDirty;\n      _formState.isDirty = output.isDirty = _getDirty();\n      isFieldDirty = isPreviousFormDirty !== output.isDirty;\n    }\n    if (_proxyFormState.dirtyFields && (!isBlurEvent || shouldDirty)) {\n      var isPreviousFieldDirty = _get(_formState.dirtyFields, name);\n      var isCurrentFieldPristine = deepEqual(_get(_defaultValues, name), fieldValue);\n      isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);\n      output.dirtyFields = _formState.dirtyFields;\n      isFieldDirty = isFieldDirty || isPreviousFieldDirty !== _get(_formState.dirtyFields, name);\n    }\n    if (isBlurEvent && !isPreviousFieldTouched) {\n      set(_formState.touchedFields, name, isBlurEvent);\n      output.touchedFields = _formState.touchedFields;\n      isFieldDirty = isFieldDirty || _proxyFormState.touchedFields && isPreviousFieldTouched !== isBlurEvent;\n    }\n    isFieldDirty && shouldRender && _subjects.state.next(output);\n    return isFieldDirty ? output : {};\n  };\n  var shouldRenderByError = /*#__PURE__*/function () {\n    var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(name, isValid, error, fieldState) {\n      var previousFieldError, shouldUpdateValid, updatedFormState;\n      return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n        while (1) {\n          switch (_context3.prev = _context3.next) {\n            case 0:\n              previousFieldError = _get(_formState.errors, name);\n              shouldUpdateValid = _proxyFormState.isValid && _formState.isValid !== isValid;\n              if (props.delayError && error) {\n                delayErrorCallback = debounce(function () {\n                  return updateErrors(name, error);\n                });\n                delayErrorCallback(props.delayError);\n              } else {\n                clearTimeout(timer);\n                delayErrorCallback = null;\n                error ? set(_formState.errors, name, error) : unset(_formState.errors, name);\n              }\n              if ((error ? !deepEqual(previousFieldError, error) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {\n                updatedFormState = _objectSpread(_objectSpread(_objectSpread({}, fieldState), shouldUpdateValid ? {\n                  isValid: isValid\n                } : {}), {}, {\n                  errors: _formState.errors,\n                  name: name\n                });\n                _formState = _objectSpread(_objectSpread({}, _formState), updatedFormState);\n                _subjects.state.next(updatedFormState);\n              }\n              validateFields[name]--;\n              if (_proxyFormState.isValidating && !Object.values(validateFields).some(function (v) {\n                return v;\n              })) {\n                _subjects.state.next({\n                  isValidating: false\n                });\n                validateFields = {};\n              }\n            case 6:\n            case \"end\":\n              return _context3.stop();\n          }\n        }\n      }, _callee3);\n    }));\n    return function shouldRenderByError(_x7, _x8, _x9, _x10) {\n      return _ref9.apply(this, arguments);\n    };\n  }();\n  var _executeSchema = /*#__PURE__*/function () {\n    var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(name) {\n      return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n        while (1) {\n          switch (_context4.prev = _context4.next) {\n            case 0:\n              if (!_options.resolver) {\n                _context4.next = 6;\n                break;\n              }\n              _context4.next = 3;\n              return _options.resolver(_objectSpread({}, _formValues), _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));\n            case 3:\n              _context4.t0 = _context4.sent;\n              _context4.next = 7;\n              break;\n            case 6:\n              _context4.t0 = {};\n            case 7:\n              return _context4.abrupt(\"return\", _context4.t0);\n            case 8:\n            case \"end\":\n              return _context4.stop();\n          }\n        }\n      }, _callee4);\n    }));\n    return function _executeSchema(_x11) {\n      return _ref10.apply(this, arguments);\n    };\n  }();\n  var executeSchemaAndUpdateState = /*#__PURE__*/function () {\n    var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(names) {\n      var _yield$_executeSchema, errors, _iterator5, _step5, _name3, _error;\n      return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n        while (1) {\n          switch (_context5.prev = _context5.next) {\n            case 0:\n              _context5.next = 2;\n              return _executeSchema();\n            case 2:\n              _yield$_executeSchema = _context5.sent;\n              errors = _yield$_executeSchema.errors;\n              if (names) {\n                _iterator5 = _createForOfIteratorHelper(names);\n                try {\n                  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n                    _name3 = _step5.value;\n                    _error = _get(errors, _name3);\n                    _error ? set(_formState.errors, _name3, _error) : unset(_formState.errors, _name3);\n                  }\n                } catch (err) {\n                  _iterator5.e(err);\n                } finally {\n                  _iterator5.f();\n                }\n              } else {\n                _formState.errors = errors;\n              }\n              return _context5.abrupt(\"return\", errors);\n            case 6:\n            case \"end\":\n              return _context5.stop();\n          }\n        }\n      }, _callee5);\n    }));\n    return function executeSchemaAndUpdateState(_x12) {\n      return _ref11.apply(this, arguments);\n    };\n  }();\n  var executeBuiltInValidation = /*#__PURE__*/function () {\n    var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(fields, shouldOnlyCheckValid) {\n      var context,\n        _name4,\n        field,\n        _f,\n        fieldValue,\n        isFieldArrayRoot,\n        fieldError,\n        _args6 = arguments;\n      return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n        while (1) {\n          switch (_context6.prev = _context6.next) {\n            case 0:\n              context = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {\n                valid: true\n              };\n              _context6.t0 = _regeneratorRuntime().keys(fields);\n            case 2:\n              if ((_context6.t1 = _context6.t0()).done) {\n                _context6.next = 23;\n                break;\n              }\n              _name4 = _context6.t1.value;\n              field = fields[_name4];\n              if (!field) {\n                _context6.next = 21;\n                break;\n              }\n              _f = field._f, fieldValue = _objectWithoutProperties(field, _excluded4);\n              if (!_f) {\n                _context6.next = 17;\n                break;\n              }\n              isFieldArrayRoot = _names.array.has(_f.name);\n              _context6.next = 11;\n              return validateField(field, _get(_formValues, _f.name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation, isFieldArrayRoot);\n            case 11:\n              fieldError = _context6.sent;\n              if (!fieldError[_f.name]) {\n                _context6.next = 16;\n                break;\n              }\n              context.valid = false;\n              if (!shouldOnlyCheckValid) {\n                _context6.next = 16;\n                break;\n              }\n              return _context6.abrupt(\"break\", 23);\n            case 16:\n              !shouldOnlyCheckValid && (_get(fieldError, _f.name) ? isFieldArrayRoot ? updateFieldArrayRootError(_formState.errors, fieldError, _f.name) : set(_formState.errors, _f.name, fieldError[_f.name]) : unset(_formState.errors, _f.name));\n            case 17:\n              _context6.t2 = fieldValue;\n              if (!_context6.t2) {\n                _context6.next = 21;\n                break;\n              }\n              _context6.next = 21;\n              return executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context);\n            case 21:\n              _context6.next = 2;\n              break;\n            case 23:\n              return _context6.abrupt(\"return\", context.valid);\n            case 24:\n            case \"end\":\n              return _context6.stop();\n          }\n        }\n      }, _callee6);\n    }));\n    return function executeBuiltInValidation(_x13, _x14) {\n      return _ref12.apply(this, arguments);\n    };\n  }();\n  var _removeUnmounted = function _removeUnmounted() {\n    var _iterator6 = _createForOfIteratorHelper(_names.unMount),\n      _step6;\n    try {\n      for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {\n        var _name5 = _step6.value;\n        var field = _get(_fields, _name5);\n        field && (field._f.refs ? field._f.refs.every(function (ref) {\n          return !live(ref);\n        }) : !live(field._f.ref)) && unregister(_name5);\n      }\n    } catch (err) {\n      _iterator6.e(err);\n    } finally {\n      _iterator6.f();\n    }\n    _names.unMount = new Set();\n  };\n  var _getDirty = function _getDirty(name, data) {\n    return name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues);\n  };\n  var _getWatch = function _getWatch(names, defaultValue, isGlobal) {\n    var fieldValues = _objectSpread({}, _stateFlags.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString(names) ? _defineProperty({}, names, defaultValue) : defaultValue);\n    return generateWatchOutput(names, _names, fieldValues, isGlobal);\n  };\n  var _getFieldArray = function _getFieldArray(name) {\n    return compact(_get(_stateFlags.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? _get(_defaultValues, name, []) : []));\n  };\n  var setFieldValue = function setFieldValue(name, value) {\n    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n    var field = _get(_fields, name);\n    var fieldValue = value;\n    if (field) {\n      var fieldReference = field._f;\n      if (fieldReference) {\n        !fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));\n        fieldValue = isWeb && isHTMLElement(fieldReference.ref) && isNullOrUndefined(value) ? '' : value;\n        if (isMultipleSelect(fieldReference.ref)) {\n          _toConsumableArray(fieldReference.ref.options).forEach(function (optionRef) {\n            return optionRef.selected = fieldValue.includes(optionRef.value);\n          });\n        } else if (fieldReference.refs) {\n          if (isCheckBoxInput(fieldReference.ref)) {\n            fieldReference.refs.length > 1 ? fieldReference.refs.forEach(function (checkboxRef) {\n              return (!checkboxRef.defaultChecked || !checkboxRef.disabled) && (checkboxRef.checked = Array.isArray(fieldValue) ? !!fieldValue.find(function (data) {\n                return data === checkboxRef.value;\n              }) : fieldValue === checkboxRef.value);\n            }) : fieldReference.refs[0] && (fieldReference.refs[0].checked = !!fieldValue);\n          } else {\n            fieldReference.refs.forEach(function (radioRef) {\n              return radioRef.checked = radioRef.value === fieldValue;\n            });\n          }\n        } else if (isFileInput(fieldReference.ref)) {\n          fieldReference.ref.value = '';\n        } else {\n          fieldReference.ref.value = fieldValue;\n          if (!fieldReference.ref.type) {\n            _subjects.watch.next({\n              name: name\n            });\n          }\n        }\n      }\n    }\n    (options.shouldDirty || options.shouldTouch) && updateTouchAndDirty(name, fieldValue, options.shouldTouch, options.shouldDirty, true);\n    options.shouldValidate && trigger(name);\n  };\n  var setValues = function setValues(name, value, options) {\n    for (var fieldKey in value) {\n      var fieldValue = value[fieldKey];\n      var fieldName = \"\".concat(name, \".\").concat(fieldKey);\n      var field = _get(_fields, fieldName);\n      (_names.array.has(name) || !isPrimitive(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options) : setFieldValue(fieldName, fieldValue, options);\n    }\n  };\n  var setValue = function setValue(name, value) {\n    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n    var field = _get(_fields, name);\n    var isFieldArray = _names.array.has(name);\n    var cloneValue = cloneObject(value);\n    set(_formValues, name, cloneValue);\n    if (isFieldArray) {\n      _subjects.array.next({\n        name: name,\n        values: _formValues\n      });\n      if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {\n        _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\n        _subjects.state.next({\n          name: name,\n          dirtyFields: _formState.dirtyFields,\n          isDirty: _getDirty(name, cloneValue)\n        });\n      }\n    } else {\n      field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);\n    }\n    isWatched(name, _names) && _subjects.state.next({});\n    _subjects.watch.next({\n      name: name\n    });\n  };\n  var onChange = /*#__PURE__*/function () {\n    var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(event) {\n      var target, name, field, _error2, isValid, fieldValue, isBlurEvent, shouldSkipValidation, watched, fieldState, shouldRender, _yield$_executeSchema2, errors, previousErrorLookupResult, errorLookupResult;\n      return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n        while (1) {\n          switch (_context7.prev = _context7.next) {\n            case 0:\n              target = event.target;\n              name = target.name;\n              field = _get(_fields, name);\n              if (!field) {\n                _context7.next = 39;\n                break;\n              }\n              fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);\n              isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;\n              shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !_get(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, _get(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);\n              watched = isWatched(name, _names, isBlurEvent);\n              set(_formValues, name, fieldValue);\n              if (isBlurEvent) {\n                field._f.onBlur && field._f.onBlur(event);\n                delayErrorCallback && delayErrorCallback(0);\n              } else if (field._f.onChange) {\n                field._f.onChange(event);\n              }\n              fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);\n              shouldRender = !isEmptyObject(fieldState) || watched;\n              !isBlurEvent && _subjects.watch.next({\n                name: name,\n                type: event.type\n              });\n              if (!shouldSkipValidation) {\n                _context7.next = 15;\n                break;\n              }\n              return _context7.abrupt(\"return\", shouldRender && _subjects.state.next(_objectSpread({\n                name: name\n              }, watched ? {} : fieldState)));\n            case 15:\n              !isBlurEvent && watched && _subjects.state.next({});\n              validateFields[name] = validateFields[name] ? +1 : 1;\n              _subjects.state.next({\n                isValidating: true\n              });\n              if (!_options.resolver) {\n                _context7.next = 30;\n                break;\n              }\n              _context7.next = 21;\n              return _executeSchema([name]);\n            case 21:\n              _yield$_executeSchema2 = _context7.sent;\n              errors = _yield$_executeSchema2.errors;\n              previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);\n              errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);\n              _error2 = errorLookupResult.error;\n              name = errorLookupResult.name;\n              isValid = isEmptyObject(errors);\n              _context7.next = 37;\n              break;\n            case 30:\n              _context7.next = 32;\n              return validateField(field, _get(_formValues, name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation);\n            case 32:\n              _context7.t0 = name;\n              _error2 = _context7.sent[_context7.t0];\n              _context7.next = 36;\n              return _updateValid(true);\n            case 36:\n              isValid = _context7.sent;\n            case 37:\n              field._f.deps && trigger(field._f.deps);\n              shouldRenderByError(name, isValid, _error2, fieldState);\n            case 39:\n            case \"end\":\n              return _context7.stop();\n          }\n        }\n      }, _callee7);\n    }));\n    return function onChange(_x15) {\n      return _ref14.apply(this, arguments);\n    };\n  }();\n  var trigger = /*#__PURE__*/function () {\n    var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(name) {\n      var options,\n        isValid,\n        validationResult,\n        fieldNames,\n        errors,\n        _args9 = arguments;\n      return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n        while (1) {\n          switch (_context9.prev = _context9.next) {\n            case 0:\n              options = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {};\n              fieldNames = convertToArrayPayload(name);\n              _subjects.state.next({\n                isValidating: true\n              });\n              if (!_options.resolver) {\n                _context9.next = 11;\n                break;\n              }\n              _context9.next = 6;\n              return executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);\n            case 6:\n              errors = _context9.sent;\n              isValid = isEmptyObject(errors);\n              validationResult = name ? !fieldNames.some(function (name) {\n                return _get(errors, name);\n              }) : isValid;\n              _context9.next = 21;\n              break;\n            case 11:\n              if (!name) {\n                _context9.next = 18;\n                break;\n              }\n              _context9.next = 14;\n              return Promise.all(fieldNames.map( /*#__PURE__*/function () {\n                var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(fieldName) {\n                  var field;\n                  return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n                    while (1) {\n                      switch (_context8.prev = _context8.next) {\n                        case 0:\n                          field = _get(_fields, fieldName);\n                          _context8.next = 3;\n                          return executeBuiltInValidation(field && field._f ? _defineProperty({}, fieldName, field) : field);\n                        case 3:\n                          return _context8.abrupt(\"return\", _context8.sent);\n                        case 4:\n                        case \"end\":\n                          return _context8.stop();\n                      }\n                    }\n                  }, _callee8);\n                }));\n                return function (_x17) {\n                  return _ref16.apply(this, arguments);\n                };\n              }()));\n            case 14:\n              validationResult = _context9.sent.every(Boolean);\n              !(!validationResult && !_formState.isValid) && _updateValid();\n              _context9.next = 21;\n              break;\n            case 18:\n              _context9.next = 20;\n              return executeBuiltInValidation(_fields);\n            case 20:\n              validationResult = isValid = _context9.sent;\n            case 21:\n              _subjects.state.next(_objectSpread(_objectSpread(_objectSpread({}, !isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : {\n                name: name\n              }), _options.resolver || !name ? {\n                isValid: isValid\n              } : {}), {}, {\n                errors: _formState.errors,\n                isValidating: false\n              }));\n              options.shouldFocus && !validationResult && focusFieldBy(_fields, function (key) {\n                return key && _get(_formState.errors, key);\n              }, name ? fieldNames : _names.mount);\n              return _context9.abrupt(\"return\", validationResult);\n            case 24:\n            case \"end\":\n              return _context9.stop();\n          }\n        }\n      }, _callee9);\n    }));\n    return function trigger(_x16) {\n      return _ref15.apply(this, arguments);\n    };\n  }();\n  var getValues = function getValues(fieldNames) {\n    var values = _objectSpread(_objectSpread({}, _defaultValues), _stateFlags.mount ? _formValues : {});\n    return isUndefined(fieldNames) ? values : isString(fieldNames) ? _get(values, fieldNames) : fieldNames.map(function (name) {\n      return _get(values, name);\n    });\n  };\n  var getFieldState = function getFieldState(name, formState) {\n    return {\n      invalid: !!_get((formState || _formState).errors, name),\n      isDirty: !!_get((formState || _formState).dirtyFields, name),\n      isTouched: !!_get((formState || _formState).touchedFields, name),\n      error: _get((formState || _formState).errors, name)\n    };\n  };\n  var clearErrors = function clearErrors(name) {\n    name ? convertToArrayPayload(name).forEach(function (inputName) {\n      return unset(_formState.errors, inputName);\n    }) : _formState.errors = {};\n    _subjects.state.next({\n      errors: _formState.errors\n    });\n  };\n  var setError = function setError(name, error, options) {\n    var ref = (_get(_fields, name, {\n      _f: {}\n    })._f || {}).ref;\n    set(_formState.errors, name, _objectSpread(_objectSpread({}, error), {}, {\n      ref: ref\n    }));\n    _subjects.state.next({\n      name: name,\n      errors: _formState.errors,\n      isValid: false\n    });\n    options && options.shouldFocus && ref && ref.focus && ref.focus();\n  };\n  var watch = function watch(name, defaultValue) {\n    return isFunction(name) ? _subjects.watch.subscribe({\n      next: function next(info) {\n        return name(_getWatch(undefined, defaultValue), info);\n      }\n    }) : _getWatch(name, defaultValue, true);\n  };\n  var unregister = function unregister(name) {\n    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n    var _iterator7 = _createForOfIteratorHelper(name ? convertToArrayPayload(name) : _names.mount),\n      _step7;\n    try {\n      for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {\n        var fieldName = _step7.value;\n        _names.mount.delete(fieldName);\n        _names.array.delete(fieldName);\n        if (_get(_fields, fieldName)) {\n          if (!options.keepValue) {\n            unset(_fields, fieldName);\n            unset(_formValues, fieldName);\n          }\n          !options.keepError && unset(_formState.errors, fieldName);\n          !options.keepDirty && unset(_formState.dirtyFields, fieldName);\n          !options.keepTouched && unset(_formState.touchedFields, fieldName);\n          !_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName);\n        }\n      }\n    } catch (err) {\n      _iterator7.e(err);\n    } finally {\n      _iterator7.f();\n    }\n    _subjects.watch.next({});\n    _subjects.state.next(_objectSpread(_objectSpread({}, _formState), !options.keepDirty ? {} : {\n      isDirty: _getDirty()\n    }));\n    !options.keepIsValid && _updateValid();\n  };\n  var register = function register(name) {\n    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n    var field = _get(_fields, name);\n    var disabledIsDefined = isBoolean(options.disabled);\n    set(_fields, name, _objectSpread(_objectSpread({}, field || {}), {}, {\n      _f: _objectSpread(_objectSpread({}, field && field._f ? field._f : {\n        ref: {\n          name: name\n        }\n      }), {}, {\n        name: name,\n        mount: true\n      }, options)\n    }));\n    _names.mount.add(name);\n    field ? disabledIsDefined && set(_formValues, name, options.disabled ? undefined : _get(_formValues, name, getFieldValue(field._f))) : updateValidAndValue(name, true, options.value);\n    return _objectSpread(_objectSpread(_objectSpread({}, disabledIsDefined ? {\n      disabled: options.disabled\n    } : {}), _options.shouldUseNativeValidation ? {\n      required: !!options.required,\n      min: getRuleValue(options.min),\n      max: getRuleValue(options.max),\n      minLength: getRuleValue(options.minLength),\n      maxLength: getRuleValue(options.maxLength),\n      pattern: getRuleValue(options.pattern)\n    } : {}), {}, {\n      name: name,\n      onChange: onChange,\n      onBlur: onChange,\n      ref: function (_ref18) {\n        function ref(_x18) {\n          return _ref18.apply(this, arguments);\n        }\n        ref.toString = function () {\n          return _ref18.toString();\n        };\n        return ref;\n      }(function (ref) {\n        if (ref) {\n          register(name, options);\n          field = _get(_fields, name);\n          var fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll('input,select,textarea')[0] || ref : ref : ref;\n          var radioOrCheckbox = isRadioOrCheckbox(fieldRef);\n          var refs = field._f.refs || [];\n          if (radioOrCheckbox ? refs.find(function (option) {\n            return option === fieldRef;\n          }) : fieldRef === field._f.ref) {\n            return;\n          }\n          set(_fields, name, {\n            _f: _objectSpread(_objectSpread({}, field._f), radioOrCheckbox ? {\n              refs: [].concat(_toConsumableArray(refs.filter(live)), [fieldRef], _toConsumableArray(!!Array.isArray(_get(_defaultValues, name)) ? [{}] : [])),\n              ref: {\n                type: fieldRef.type,\n                name: name\n              }\n            } : {\n              ref: fieldRef\n            })\n          });\n          updateValidAndValue(name, false, undefined, fieldRef);\n        } else {\n          field = _get(_fields, name, {});\n          if (field._f) {\n            field._f.mount = false;\n          }\n          (_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _stateFlags.action) && _names.unMount.add(name);\n        }\n      })\n    });\n  };\n  var _focusError = function _focusError() {\n    return _options.shouldFocusError && focusFieldBy(_fields, function (key) {\n      return key && _get(_formState.errors, key);\n    }, _names.mount);\n  };\n  var handleSubmit = function handleSubmit(onValid, onInvalid) {\n    return /*#__PURE__*/function () {\n      var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e) {\n        var hasNoPromiseError, fieldValues, _yield$_executeSchema3, errors, values;\n        return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n          while (1) {\n            switch (_context10.prev = _context10.next) {\n              case 0:\n                if (e) {\n                  e.preventDefault && e.preventDefault();\n                  e.persist && e.persist();\n                }\n                hasNoPromiseError = true;\n                fieldValues = cloneObject(_formValues);\n                _subjects.state.next({\n                  isSubmitting: true\n                });\n                _context10.prev = 4;\n                if (!_options.resolver) {\n                  _context10.next = 15;\n                  break;\n                }\n                _context10.next = 8;\n                return _executeSchema();\n              case 8:\n                _yield$_executeSchema3 = _context10.sent;\n                errors = _yield$_executeSchema3.errors;\n                values = _yield$_executeSchema3.values;\n                _formState.errors = errors;\n                fieldValues = values;\n                _context10.next = 17;\n                break;\n              case 15:\n                _context10.next = 17;\n                return executeBuiltInValidation(_fields);\n              case 17:\n                if (!isEmptyObject(_formState.errors)) {\n                  _context10.next = 23;\n                  break;\n                }\n                _subjects.state.next({\n                  errors: {},\n                  isSubmitting: true\n                });\n                _context10.next = 21;\n                return onValid(fieldValues, e);\n              case 21:\n                _context10.next = 27;\n                break;\n              case 23:\n                if (!onInvalid) {\n                  _context10.next = 26;\n                  break;\n                }\n                _context10.next = 26;\n                return onInvalid(_objectSpread({}, _formState.errors), e);\n              case 26:\n                _focusError();\n              case 27:\n                _context10.next = 33;\n                break;\n              case 29:\n                _context10.prev = 29;\n                _context10.t0 = _context10[\"catch\"](4);\n                hasNoPromiseError = false;\n                throw _context10.t0;\n              case 33:\n                _context10.prev = 33;\n                _formState.isSubmitted = true;\n                _subjects.state.next({\n                  isSubmitted: true,\n                  isSubmitting: false,\n                  isSubmitSuccessful: isEmptyObject(_formState.errors) && hasNoPromiseError,\n                  submitCount: _formState.submitCount + 1,\n                  errors: _formState.errors\n                });\n                return _context10.finish(33);\n              case 37:\n              case \"end\":\n                return _context10.stop();\n            }\n          }\n        }, _callee10, null, [[4, 29, 33, 37]]);\n      }));\n      return function (_x19) {\n        return _ref19.apply(this, arguments);\n      };\n    }();\n  };\n  var resetField = function resetField(name) {\n    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n    if (_get(_fields, name)) {\n      if (isUndefined(options.defaultValue)) {\n        setValue(name, _get(_defaultValues, name));\n      } else {\n        setValue(name, options.defaultValue);\n        set(_defaultValues, name, options.defaultValue);\n      }\n      if (!options.keepTouched) {\n        unset(_formState.touchedFields, name);\n      }\n      if (!options.keepDirty) {\n        unset(_formState.dirtyFields, name);\n        _formState.isDirty = options.defaultValue ? _getDirty(name, _get(_defaultValues, name)) : _getDirty();\n      }\n      if (!options.keepError) {\n        unset(_formState.errors, name);\n        _proxyFormState.isValid && _updateValid();\n      }\n      _subjects.state.next(_objectSpread({}, _formState));\n    }\n  };\n  var _reset = function _reset(formValues) {\n    var keepStateOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n    var updatedValues = formValues || _defaultValues;\n    var cloneUpdatedValues = cloneObject(updatedValues);\n    var values = formValues && !isEmptyObject(formValues) ? cloneUpdatedValues : _defaultValues;\n    if (!keepStateOptions.keepDefaultValues) {\n      _defaultValues = updatedValues;\n    }\n    if (!keepStateOptions.keepValues) {\n      if (keepStateOptions.keepDirtyValues) {\n        var _iterator8 = _createForOfIteratorHelper(_names.mount),\n          _step8;\n        try {\n          for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {\n            var fieldName = _step8.value;\n            _get(_formState.dirtyFields, fieldName) ? set(values, fieldName, _get(_formValues, fieldName)) : setValue(fieldName, _get(values, fieldName));\n          }\n        } catch (err) {\n          _iterator8.e(err);\n        } finally {\n          _iterator8.f();\n        }\n      } else {\n        if (isWeb && isUndefined(formValues)) {\n          var _iterator9 = _createForOfIteratorHelper(_names.mount),\n            _step9;\n          try {\n            for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {\n              var _name6 = _step9.value;\n              var field = _get(_fields, _name6);\n              if (field && field._f) {\n                var fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;\n                try {\n                  if (isHTMLElement(fieldReference)) {\n                    fieldReference.closest('form').reset();\n                    break;\n                  }\n                } catch (_a) {}\n              }\n            }\n          } catch (err) {\n            _iterator9.e(err);\n          } finally {\n            _iterator9.f();\n          }\n        }\n        _fields = {};\n      }\n      _formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneUpdatedValues;\n      _subjects.array.next({\n        values: values\n      });\n      _subjects.watch.next({\n        values: values\n      });\n    }\n    _names = {\n      mount: new Set(),\n      unMount: new Set(),\n      array: new Set(),\n      watch: new Set(),\n      watchAll: false,\n      focus: ''\n    };\n    _stateFlags.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;\n    _stateFlags.watch = !!props.shouldUnregister;\n    _subjects.state.next({\n      submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,\n      isDirty: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),\n      isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,\n      dirtyFields: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : {},\n      touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},\n      errors: keepStateOptions.keepErrors ? _formState.errors : {},\n      isSubmitting: false,\n      isSubmitSuccessful: false\n    });\n  };\n  var reset = function reset(formValues, keepStateOptions) {\n    return _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);\n  };\n  var setFocus = function setFocus(name) {\n    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n    var field = _get(_fields, name);\n    var fieldReference = field && field._f;\n    if (fieldReference) {\n      var fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;\n      if (fieldRef.focus) {\n        fieldRef.focus();\n        options.shouldSelect && fieldRef.select();\n      }\n    }\n  };\n  return {\n    control: {\n      register: register,\n      unregister: unregister,\n      getFieldState: getFieldState,\n      _executeSchema: _executeSchema,\n      _focusError: _focusError,\n      _getWatch: _getWatch,\n      _getDirty: _getDirty,\n      _updateValid: _updateValid,\n      _removeUnmounted: _removeUnmounted,\n      _updateFieldArray: _updateFieldArray,\n      _getFieldArray: _getFieldArray,\n      _subjects: _subjects,\n      _proxyFormState: _proxyFormState,\n      get _fields() {\n        return _fields;\n      },\n      get _formValues() {\n        return _formValues;\n      },\n      get _stateFlags() {\n        return _stateFlags;\n      },\n      set _stateFlags(value) {\n        _stateFlags = value;\n      },\n      get _defaultValues() {\n        return _defaultValues;\n      },\n      get _names() {\n        return _names;\n      },\n      set _names(value) {\n        _names = value;\n      },\n      get _formState() {\n        return _formState;\n      },\n      set _formState(value) {\n        _formState = value;\n      },\n      get _options() {\n        return _options;\n      },\n      set _options(value) {\n        _options = _objectSpread(_objectSpread({}, _options), value);\n      }\n    },\n    trigger: trigger,\n    register: register,\n    handleSubmit: handleSubmit,\n    watch: watch,\n    setValue: setValue,\n    getValues: getValues,\n    reset: reset,\n    resetField: resetField,\n    clearErrors: clearErrors,\n    unregister: unregister,\n    setError: setError,\n    setFocus: setFocus,\n    getFieldState: getFieldState\n  };\n}\n\n/**\r\n * Custom hook to manage the entire form.\r\n *\r\n * @remarks\r\n * [API](https://react-hook-form.com/api/useform) • [Demo](https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm) • [Video](https://www.youtube.com/watch?v=RkXv4AXXC_4)\r\n *\r\n * @param props - form configuration and validation parameters.\r\n *\r\n * @returns methods - individual functions to manage the form state. {@link UseFormReturn}\r\n *\r\n * @example\r\n * ```tsx\r\n * function App() {\r\n *   const { register, handleSubmit, watch, formState: { errors } } = useForm();\r\n *   const onSubmit = data => console.log(data);\r\n *\r\n *   console.log(watch(\"example\"));\r\n *\r\n *   return (\r\n *     <form onSubmit={handleSubmit(onSubmit)}>\r\n *       <input defaultValue=\"test\" {...register(\"example\")} />\r\n *       <input {...register(\"exampleRequired\", { required: true })} />\r\n *       {errors.exampleRequired && <span>This field is required</span>}\r\n *       <input type=\"submit\" />\r\n *     </form>\r\n *   );\r\n * }\r\n * ```\r\n */\nfunction useForm() {\n  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  var _formControl = React.useRef();\n  var _React$useState7 = React.useState({\n      isDirty: false,\n      isValidating: false,\n      isSubmitted: false,\n      isSubmitting: false,\n      isSubmitSuccessful: false,\n      isValid: false,\n      submitCount: 0,\n      dirtyFields: {},\n      touchedFields: {},\n      errors: {},\n      defaultValues: props.defaultValues\n    }),\n    _React$useState8 = _slicedToArray(_React$useState7, 2),\n    formState = _React$useState8[0],\n    updateFormState = _React$useState8[1];\n  if (!_formControl.current) {\n    _formControl.current = _objectSpread(_objectSpread({}, createFormControl(props)), {}, {\n      formState: formState\n    });\n  }\n  var control = _formControl.current.control;\n  control._options = props;\n  useSubscribe({\n    subject: control._subjects.state,\n    callback: React.useCallback(function (value) {\n      if (shouldRenderFormState(value, control._proxyFormState, true)) {\n        control._formState = _objectSpread(_objectSpread({}, control._formState), value);\n        updateFormState(_objectSpread({}, control._formState));\n      }\n    }, [control])\n  });\n  React.useEffect(function () {\n    if (!control._stateFlags.mount) {\n      control._proxyFormState.isValid && control._updateValid();\n      control._stateFlags.mount = true;\n    }\n    if (control._stateFlags.watch) {\n      control._stateFlags.watch = false;\n      control._subjects.state.next({});\n    }\n    control._removeUnmounted();\n  });\n  React.useEffect(function () {\n    formState.submitCount && control._focusError();\n  }, [control, formState.submitCount]);\n  _formControl.current.formState = getProxyFormState(formState, control);\n  return _formControl.current;\n}\nexport { Controller, FormProvider, appendErrors, _get as get, set, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch };","map":{"version":3,"mappings":";;;;;;;;;;;;;AAEA,sBAAe,SAAfA,gBAAgBC,OAAqB;EAAA,OACnCA,OAAO,CAACC,IAAI,KAAK,UAAU;AAAA;ACH7B,mBAAe,SAAfC,aAAgBC,KAAc;EAAA,OAAoBA,KAAK,YAAYC,IAAI;AAAA;ACAvE,wBAAe,SAAfC,kBAAgBF,KAAc;EAAA,OAAgCA,KAAK,IAAI,IAAI;AAAA;ACGpE,IAAMG,YAAY,GAAG,SAAfA,YAAY,CAAIH,KAAc;EAAA,OAAK,OAAOA,KAAK,KAAK,QAAQ;AAAA;AAEzE,eAAe,SAAfI,SAAkCJ,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AO,CAAC;EAEZ,EAAC;EAEFX,KAAK,CAACqC,SAAS,CAAC,YAAK;IACnB,IAAI,CAAC1B,OAAO,CAACoF,WAAW,CAACH,KAAK,EAAE;MAC9BjF,OAAO,CAACQ,eAAe,CAACqC,OAAO,IAAI7C,OAAO,CAACuR,YAAY,EAAE;MACzDvR,OAAO,CAACoF,WAAW,CAACH,KAAK,GAAG,IAAI;IACjC;IAED,IAAIjF,OAAO,CAACoF,WAAW,CAAC5B,KAAK,EAAE;MAC7BxD,OAAO,CAACoF,WAAW,CAAC5B,KAAK,GAAG,KAAK;MACjCxD,OAAO,CAACiD,SAAS,CAACC,KAAK,CAACnB,IAAI,CAAC,EAAE,CAAC;IACjC;IAED/B,OAAO,CAACqE,gBAAgB,EAAE;EAC5B,CAAC,CAAC;EAEFhF,KAAK,CAACqC,SAAS,CAAC,YAAK;IACnB3B,SAAS,CAACyU,WAAW,IAAIxU,OAAO,CAAC+Z,WAAW,EAAE;GAC/C,EAAE,CAAC/Z,OAAO,EAAED,SAAS,CAACyU,WAAW,CAAC,CAAC;EAEpC8G,YAAY,CAAC7Z,OAAO,CAAC1B,SAAS,GAAGD,iBAAiB,CAACC,SAAS,EAAEC,OAAO,CAAC;EAEtE,OAAOsb,YAAY,CAAC7Z,OAAO;AAC7B","names":["isCheckBoxInput","element","type","isDateObject","value","Date","isNullOrUndefined","isObjectType","isObject","Array","isArray","getEventValue","event","target","checked","getNodeParentName","name","substring","search","isNameInFieldArray","names","has","compact","filter","Boolean","isUndefined","val","undefined","get","obj","path","defaultValue","result","split","reduce","key","EVENTS","BLUR","FOCUS_OUT","CHANGE","VALIDATION_MODE","onBlur","onChange","onSubmit","onTouched","all","INPUT_VALIDATION_RULES","max","min","maxLength","minLength","pattern","required","validate","HookFormContext","React","createContext","useFormContext","useContext","FormProvider","props","children","data","Provider","getProxyFormState","formState","control","localProxyFormState","isRoot","defaultValues","_defaultValues","Object","defineProperty","_key","_proxyFormState","isEmptyObject","keys","length","shouldRenderFormState","formStateData","find","convertToArrayPayload","shouldSubscribeByName","signalName","exact","some","currentName","startsWith","useSubscribe","_props","useRef","current","useEffect","subscription","disabled","subject","subscribe","next","callback","unsubscribe","useFormState","methods","useState","_formState","updateFormState","_mounted","_localProxyFormState","isDirty","dirtyFields","touchedFields","isValidating","isValid","errors","_name","useCallback","_subjects","state","isString","generateWatchOutput","_names","formValues","isGlobal","watch","add","map","fieldName","watchAll","isFunction","objectHasFunction","useWatch","fieldValues","values","_formValues","updateValue","_getWatch","_removeUnmounted","useController","shouldUnregister","isArrayField","array","_registerProps","register","rules","updateMounted","field","_fields","_f","mount","_shouldUnregisterField","_options","_stateFlags","action","unregister","ref","elm","focus","select","setCustomValidity","message","reportValidity","fieldState","defineProperties","invalid","enumerable","isTouched","error","Controller","render","appendErrors","validateAllFieldCriteria","types","isKey","test","stringToPath","input","replace","object","index","tempPath","lastIndex","newValue","objValue","isNaN","focusFieldBy","fields","fieldsNames","currentField","refs","generateId","d","performance","now","c","r","Math","random","toString","getFocusFieldName","options","shouldFocus","focusName","focusIndex","isWatched","isBlurEvent","watchName","slice","updateFieldArrayRootError","fieldArrayErrors","set","isBoolean","isFileInput","isMessage","isValidElement","isRadioInput","isRegex","RegExp","defaultResult","validResult","getCheckboxValue","option","attributes","defaultReturn","getRadioValue","previous","getValidateError","every","getValueAndMessage","validationData","inputValue","shouldUseNativeValidation","isFieldArray","valueAsNumber","inputRef","isRadio","isCheckBox","isRadioOrCheckbox","isEmpty","appendErrorsCurry","bind","getMinMaxMessage","exceedMax","maxLengthMessage","minLengthMessage","maxType","minType","maxOutput","minOutput","valueNumber","exceedMin","valueDate","valueAsDate","convertTimeToDate","time","toDateString","isTime","isWeek","maxLengthOutput","minLengthOutput","patternValue","match","validateError","validationResult","validateField","append","isPlainObject","tempObject","prototypeCopy","constructor","prototype","hasOwnProperty","window","HTMLElement","document","copy","Set","isWeb","Blob","FileList","cloneObject","fillEmptyArray","getValidationModes","mode","isOnSubmit","isOnBlur","isOnChange","isOnAll","isOnTouch","moveArrayAt","from","to","splice","prepend","removeAtIndexes","indexes","i","temp","removeArrayAt","sort","a","b","swapArrayAt","indexA","indexB","baseGet","updatePath","isEmptyArray","unset","childObject","previousObjRef","k","objectRef","currentPaths","currentPathsLength","item","updateAt","useFieldArray","keyName","_getFieldArray","setFields","ids","_fieldIds","_actioned","fieldArrayName","updateValues","updatedFieldArrayValues","_updateFieldArray","appendValue","appendAt","argA","prependValue","prependAt","remove","insert","insertValue","insertAt","argB","swap","move","update","isSubmitted","resolver","_executeSchema","then","existingError","criteriaMode","_updateValid","useMemo","createSubject","_observers","observer","push","o","observers","isPrimitive","deepEqual","object1","object2","getTime","keys1","keys2","val1","includes","val2","isHTMLElement","owner","ownerDocument","ElementClass","defaultView","isMultipleSelect","live","isConnected","markFieldsDirty","isParentNodeArray","getDirtyFieldsFromDefaultValues","dirtyFieldsFromValues","getDirtyFields","getFieldValueAs","setValueAs","NaN","files","selectedOptions","getResolverOptions","getRuleValue","rule","source","hasValidation","join","foundError","pop","skipValidation","reValidateMode","unsetEmptyArray","defaultOptions","shouldFocusError","submitCount","isSubmitting","isSubmitSuccessful","unMount","delayErrorCallback","timer","validateFields","validationModeBeforeSubmit","validationModeAfterSubmit","shouldDisplayAllAssociatedErrors","debounce","wait","clearTimeout","setTimeout","shouldSkipRender","executeBuiltInValidation","method","args","shouldSetValues","shouldUpdateFieldsAndState","_getDirty","updateErrors","updateValidAndValue","shouldSkipSetValueAs","defaultChecked","getFieldValue","setFieldValue","updateTouchAndDirty","fieldValue","shouldDirty","shouldRender","isFieldDirty","output","isPreviousFieldTouched","isPreviousFormDirty","isPreviousFieldDirty","isCurrentFieldPristine","shouldRenderByError","previousFieldError","shouldUpdateValid","delayError","updatedFormState","v","context","executeSchemaAndUpdateState","shouldOnlyCheckValid","valid","isFieldArrayRoot","fieldError","getValues","fieldReference","forEach","optionRef","selected","checkboxRef","radioRef","shouldTouch","shouldValidate","trigger","setValues","fieldKey","setValue","cloneValue","shouldSkipValidation","deps","watched","previousErrorLookupResult","schemaErrorLookup","errorLookupResult","fieldNames","Promise","getFieldState","clearErrors","inputName","setError","info","delete","keepValue","keepError","keepDirty","keepTouched","keepDefaultValue","keepIsValid","disabledIsDefined","fieldRef","querySelectorAll","radioOrCheckbox","_focusError","handleSubmit","onValid","onInvalid","e","preventDefault","persist","hasNoPromiseError","resetField","_reset","keepStateOptions","updatedValues","cloneUpdatedValues","keepDefaultValues","keepValues","keepDirtyValues","closest","reset","keepSubmitCount","keepIsSubmitted","keepErrors","setFocus","shouldSelect","_formControl","createFormControl"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isCheckBoxInput.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isDateObject.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isNullOrUndefined.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isObject.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getEventValue.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getNodeParentName.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/isNameInFieldArray.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/compact.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isUndefined.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/get.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/constants.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/useFormContext.tsx","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getProxyFormState.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isEmptyObject.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/shouldRenderFormState.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/convertToArrayPayload.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/shouldSubscribeByName.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/useSubscribe.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/useFormState.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isString.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/generateWatchOutput.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isFunction.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/objectHasFunction.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/useWatch.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/useController.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/controller.tsx","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/appendErrors.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isKey.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/stringToPath.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/set.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/focusFieldBy.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/generateId.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getFocusFieldName.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/isWatched.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/updateFieldArrayRootError.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isBoolean.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isFileInput.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isMessage.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isRadioInput.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isRegex.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getCheckboxValue.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getRadioValue.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getValidateError.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getValueAndMessage.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/validateField.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/append.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isPlainObject.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isWeb.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/cloneObject.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/fillEmptyArray.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/getValidationModes.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/insert.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/move.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/prepend.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/remove.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/swap.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/unset.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/update.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/useFieldArray.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/createSubject.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isPrimitive.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/deepEqual.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isHTMLElement.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isMultipleSelect.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/isRadioOrCheckbox.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/utils/live.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getDirtyFields.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getFieldValueAs.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getFieldValue.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getResolverOptions.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/getRuleValue.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/hasValidation.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/schemaErrorLookup.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/skipValidation.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/unsetEmptyArray.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/logic/createFormControl.ts","/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/react-hook-form/src/useForm.ts"],"sourcesContent":["import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLInputElement =>\n  element.type === 'checkbox';\n","export default (value: unknown): value is Date => value instanceof Date;\n","export default (value: unknown): value is null | undefined => value == null;\n","import isDateObject from './isDateObject';\nimport isNullOrUndefined from './isNullOrUndefined';\n\nexport const isObjectType = (value: unknown) => typeof value === 'object';\n\nexport default <T extends object>(value: unknown): value is T =>\n  !isNullOrUndefined(value) &&\n  !Array.isArray(value) &&\n  isObjectType(value) &&\n  !isDateObject(value);\n","import isCheckBoxInput from '../utils/isCheckBoxInput';\nimport isObject from '../utils/isObject';\n\ntype Event = { target: any };\n\nexport default (event: unknown) =>\n  isObject(event) && (event as Event).target\n    ? isCheckBoxInput((event as Event).target)\n      ? (event as Event).target.checked\n      : (event as Event).target.value\n    : event;\n","export default (name: string) =>\n  name.substring(0, name.search(/\\.\\d+(\\.|$)/)) || name;\n","import { InternalFieldName } from '../types';\n\nimport getNodeParentName from './getNodeParentName';\n\nexport default (names: Set<InternalFieldName>, name: InternalFieldName) =>\n  names.has(getNodeParentName(name));\n","export default <TValue>(value: TValue[]) =>\n  Array.isArray(value) ? value.filter(Boolean) : [];\n","export default (val: unknown): val is undefined => val === undefined;\n","import compact from './compact';\nimport isNullOrUndefined from './isNullOrUndefined';\nimport isObject from './isObject';\nimport isUndefined from './isUndefined';\n\nexport default <T>(obj: T, path: string, defaultValue?: unknown): any => {\n  if (!path || !isObject(obj)) {\n    return defaultValue;\n  }\n\n  const result = compact(path.split(/[,[\\].]+?/)).reduce(\n    (result, key) =>\n      isNullOrUndefined(result) ? result : result[key as keyof {}],\n    obj,\n  );\n\n  return isUndefined(result) || result === obj\n    ? isUndefined(obj[path as keyof T])\n      ? defaultValue\n      : obj[path as keyof T]\n    : result;\n};\n","import { ValidationMode } from './types';\n\nexport const EVENTS = {\n  BLUR: 'blur',\n  FOCUS_OUT: 'focusout',\n  CHANGE: 'change',\n};\n\nexport const VALIDATION_MODE: ValidationMode = {\n  onBlur: 'onBlur',\n  onChange: 'onChange',\n  onSubmit: 'onSubmit',\n  onTouched: 'onTouched',\n  all: 'all',\n};\n\nexport const INPUT_VALIDATION_RULES = {\n  max: 'max',\n  min: 'min',\n  maxLength: 'maxLength',\n  minLength: 'minLength',\n  pattern: 'pattern',\n  required: 'required',\n  validate: 'validate',\n};\n","import React from 'react';\n\nimport { FieldValues, FormProviderProps, UseFormReturn } from './types';\n\nconst HookFormContext = React.createContext<UseFormReturn | null>(null);\n\n/**\n * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\n *\n * @returns return all useForm methods\n *\n * @example\n * ```tsx\n * function App() {\n *   const methods = useForm();\n *   const onSubmit = data => console.log(data);\n *\n *   return (\n *     <FormProvider {...methods} >\n *       <form onSubmit={methods.handleSubmit(onSubmit)}>\n *         <NestedInput />\n *         <input type=\"submit\" />\n *       </form>\n *     </FormProvider>\n *   );\n * }\n *\n *  function NestedInput() {\n *   const { register } = useFormContext(); // retrieve all hook methods\n *   return <input {...register(\"test\")} />;\n * }\n * ```\n */\nexport const useFormContext = <\n  TFieldValues extends FieldValues,\n>(): UseFormReturn<TFieldValues> =>\n  React.useContext(HookFormContext) as unknown as UseFormReturn<TFieldValues>;\n\n/**\n * A provider component that propagates the `useForm` methods to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useFormContext}.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\n *\n * @param props - all useFrom methods\n *\n * @example\n * ```tsx\n * function App() {\n *   const methods = useForm();\n *   const onSubmit = data => console.log(data);\n *\n *   return (\n *     <FormProvider {...methods} >\n *       <form onSubmit={methods.handleSubmit(onSubmit)}>\n *         <NestedInput />\n *         <input type=\"submit\" />\n *       </form>\n *     </FormProvider>\n *   );\n * }\n *\n *  function NestedInput() {\n *   const { register } = useFormContext(); // retrieve all hook methods\n *   return <input {...register(\"test\")} />;\n * }\n * ```\n */\nexport const FormProvider = <TFieldValues extends FieldValues, TContext = any>(\n  props: FormProviderProps<TFieldValues, TContext>,\n) => {\n  const { children, ...data } = props;\n  return (\n    <HookFormContext.Provider value={data as unknown as UseFormReturn}>\n      {children}\n    </HookFormContext.Provider>\n  );\n};\n","import { VALIDATION_MODE } from '../constants';\nimport { Control, FieldValues, FormState, ReadFormState } from '../types';\n\nexport default <TFieldValues extends FieldValues>(\n  formState: FormState<TFieldValues>,\n  control: Control<TFieldValues>,\n  localProxyFormState?: ReadFormState,\n  isRoot = true,\n) => {\n  const result = {\n    defaultValues: control._defaultValues,\n  } as typeof formState;\n\n  for (const key in formState) {\n    Object.defineProperty(result, key, {\n      get: () => {\n        const _key = key as keyof FormState<TFieldValues> & keyof ReadFormState;\n\n        if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {\n          control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;\n        }\n\n        localProxyFormState && (localProxyFormState[_key] = true);\n        return formState[_key];\n      },\n    });\n  }\n\n  return result;\n};\n","import { EmptyObject } from '../types';\n\nimport isObject from './isObject';\n\nexport default (value: unknown): value is EmptyObject =>\n  isObject(value) && !Object.keys(value).length;\n","import { VALIDATION_MODE } from '../constants';\nimport { ReadFormState } from '../types';\nimport isEmptyObject from '../utils/isEmptyObject';\n\nexport default <T extends Record<string, any>, K extends ReadFormState>(\n  formStateData: T,\n  _proxyFormState: K,\n  isRoot?: boolean,\n) => {\n  const { name, ...formState } = formStateData;\n\n  return (\n    isEmptyObject(formState) ||\n    Object.keys(formState).length >= Object.keys(_proxyFormState).length ||\n    Object.keys(formState).find(\n      (key) =>\n        _proxyFormState[key as keyof ReadFormState] ===\n        (!isRoot || VALIDATION_MODE.all),\n    )\n  );\n};\n","export default <T>(value: T) => (Array.isArray(value) ? value : [value]);\n","import convertToArrayPayload from '../utils/convertToArrayPayload';\n\nexport default <T extends string | string[] | undefined>(\n  name?: T,\n  signalName?: string,\n  exact?: boolean,\n) =>\n  exact && signalName\n    ? name === signalName\n    : !name ||\n      !signalName ||\n      name === signalName ||\n      convertToArrayPayload(name).some(\n        (currentName) =>\n          currentName &&\n          (currentName.startsWith(signalName) ||\n            signalName.startsWith(currentName)),\n      );\n","import React from 'react';\n\nimport { Subject } from './utils/createSubject';\n\ntype Props<T> = {\n  disabled?: boolean;\n  subject: Subject<T>;\n  callback: (value: T) => void;\n};\n\nexport function useSubscribe<T>(props: Props<T>) {\n  const _props = React.useRef(props);\n  _props.current = props;\n\n  React.useEffect(() => {\n    const subscription =\n      !props.disabled &&\n      _props.current.subject.subscribe({\n        next: _props.current.callback,\n      });\n\n    return () => {\n      subscription && subscription.unsubscribe();\n    };\n  }, [props.disabled]);\n}\n","import React from 'react';\n\nimport getProxyFormState from './logic/getProxyFormState';\nimport shouldRenderFormState from './logic/shouldRenderFormState';\nimport shouldSubscribeByName from './logic/shouldSubscribeByName';\nimport {\n  FieldValues,\n  InternalFieldName,\n  UseFormStateProps,\n  UseFormStateReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)\n *\n * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}\n *\n * @example\n * ```tsx\n * function App() {\n *   const { register, handleSubmit, control } = useForm({\n *     defaultValues: {\n *     firstName: \"firstName\"\n *   }});\n *   const { dirtyFields } = useFormState({\n *     control\n *   });\n *   const onSubmit = (data) => console.log(data);\n *\n *   return (\n *     <form onSubmit={handleSubmit(onSubmit)}>\n *       <input {...register(\"firstName\")} placeholder=\"First Name\" />\n *       {dirtyFields.firstName && <p>Field is dirty.</p>}\n *       <input type=\"submit\" />\n *     </form>\n *   );\n * }\n * ```\n */\nfunction useFormState<TFieldValues extends FieldValues = FieldValues>(\n  props?: UseFormStateProps<TFieldValues>,\n): UseFormStateReturn<TFieldValues> {\n  const methods = useFormContext<TFieldValues>();\n  const { control = methods.control, disabled, name, exact } = props || {};\n  const [formState, updateFormState] = React.useState(control._formState);\n  const _mounted = React.useRef(true);\n  const _localProxyFormState = React.useRef({\n    isDirty: false,\n    dirtyFields: false,\n    touchedFields: false,\n    isValidating: false,\n    isValid: false,\n    errors: false,\n  });\n  const _name = React.useRef(name);\n\n  _name.current = name;\n\n  useSubscribe({\n    disabled,\n    callback: React.useCallback(\n      (value: { name?: InternalFieldName }) =>\n        _mounted.current &&\n        shouldSubscribeByName(\n          _name.current as InternalFieldName,\n          value.name,\n          exact,\n        ) &&\n        shouldRenderFormState(value, _localProxyFormState.current) &&\n        updateFormState({\n          ...control._formState,\n          ...value,\n        }),\n      [control, exact],\n    ),\n    subject: control._subjects.state,\n  });\n\n  React.useEffect(() => {\n    _mounted.current = true;\n    return () => {\n      _mounted.current = false;\n    };\n  }, []);\n\n  return getProxyFormState(\n    formState,\n    control,\n    _localProxyFormState.current,\n    false,\n  );\n}\n\nexport { useFormState };\n","export default (value: unknown): value is string => typeof value === 'string';\n","import { FieldValues, InternalFieldName, Names } from '../types';\nimport get from '../utils/get';\nimport isString from '../utils/isString';\n\nexport default (\n  names: string | string[] | undefined,\n  _names: Names,\n  formValues?: FieldValues,\n  isGlobal?: boolean,\n) => {\n  const isArray = Array.isArray(names);\n  if (isString(names)) {\n    isGlobal && _names.watch.add(names as InternalFieldName);\n    return get(formValues, names as InternalFieldName);\n  }\n\n  if (isArray) {\n    return names.map(\n      (fieldName) => (\n        isGlobal && _names.watch.add(fieldName as InternalFieldName),\n        get(formValues, fieldName as InternalFieldName)\n      ),\n    );\n  }\n\n  isGlobal && (_names.watchAll = true);\n  return formValues;\n};\n","export default (value: unknown): value is Function =>\n  typeof value === 'function';\n","import isFunction from './isFunction';\n\nexport default <T>(data: T): boolean => {\n  for (const key in data) {\n    if (isFunction(data[key])) {\n      return true;\n    }\n  }\n  return false;\n};\n","import React from 'react';\n\nimport generateWatchOutput from './logic/generateWatchOutput';\nimport shouldSubscribeByName from './logic/shouldSubscribeByName';\nimport isObject from './utils/isObject';\nimport isUndefined from './utils/isUndefined';\nimport objectHasFunction from './utils/objectHasFunction';\nimport {\n  Control,\n  DeepPartialSkipArrayKey,\n  FieldPath,\n  FieldPathValue,\n  FieldPathValues,\n  FieldValues,\n  InternalFieldName,\n  UseWatchProps,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * Subscribe to the entire form values change and re-render at the hook level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @param props - defaultValue, disable subscription and match exact name.\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n *   control,\n *   defaultValue: {\n *     name: \"data\"\n *   },\n *   exact: false,\n * })\n * ```\n */\nexport function useWatch<\n  TFieldValues extends FieldValues = FieldValues,\n>(props: {\n  defaultValue?: DeepPartialSkipArrayKey<TFieldValues>;\n  control?: Control<TFieldValues>;\n  disabled?: boolean;\n  exact?: boolean;\n}): DeepPartialSkipArrayKey<TFieldValues>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @param props - defaultValue, disable subscription and match exact name.\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n *   control,\n *   name: \"fieldA\",\n *   defaultValue: \"default value\",\n *   exact: false,\n * })\n * ```\n */\nexport function useWatch<\n  TFieldValues extends FieldValues = FieldValues,\n  TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(props: {\n  name: TFieldName;\n  defaultValue?: FieldPathValue<TFieldValues, TFieldName>;\n  control?: Control<TFieldValues>;\n  disabled?: boolean;\n  exact?: boolean;\n}): FieldPathValue<TFieldValues, TFieldName>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @param props - defaultValue, disable subscription and match exact name.\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n *   control,\n *   name: [\"fieldA\", \"fieldB\"],\n *   defaultValue: {\n *     fieldA: \"data\",\n *     fieldB: \"data\"\n *   },\n *   exact: false,\n * })\n * ```\n */\nexport function useWatch<\n  TFieldValues extends FieldValues = FieldValues,\n  TFieldNames extends readonly FieldPath<TFieldValues>[] = readonly FieldPath<TFieldValues>[],\n>(props: {\n  name: readonly [...TFieldNames];\n  defaultValue?: DeepPartialSkipArrayKey<TFieldValues>;\n  control?: Control<TFieldValues>;\n  disabled?: boolean;\n  exact?: boolean;\n}): FieldPathValues<TFieldValues, TFieldNames>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @example\n * ```tsx\n * // can skip passing down the control into useWatch if the form is wrapped with the FormProvider\n * const values = useWatch()\n * ```\n */\nexport function useWatch<\n  TFieldValues extends FieldValues = FieldValues,\n>(): DeepPartialSkipArrayKey<TFieldValues>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n *   name: \"fieldName\"\n *   control,\n * })\n * ```\n */\nexport function useWatch<TFieldValues extends FieldValues>(\n  props?: UseWatchProps<TFieldValues>,\n) {\n  const methods = useFormContext();\n  const {\n    control = methods.control,\n    name,\n    defaultValue,\n    disabled,\n    exact,\n  } = props || {};\n  const _name = React.useRef(name);\n\n  _name.current = name;\n\n  useSubscribe({\n    disabled,\n    subject: control._subjects.watch,\n    callback: React.useCallback(\n      (formState: { name?: InternalFieldName; values?: FieldValues }) => {\n        if (\n          shouldSubscribeByName(\n            _name.current as InternalFieldName,\n            formState.name,\n            exact,\n          )\n        ) {\n          const fieldValues = generateWatchOutput(\n            _name.current as InternalFieldName | InternalFieldName[],\n            control._names,\n            formState.values || control._formValues,\n          );\n\n          updateValue(\n            isUndefined(_name.current) ||\n              (isObject(fieldValues) && !objectHasFunction(fieldValues))\n              ? { ...fieldValues }\n              : Array.isArray(fieldValues)\n              ? [...fieldValues]\n              : isUndefined(fieldValues)\n              ? defaultValue\n              : fieldValues,\n          );\n        }\n      },\n      [control, exact, defaultValue],\n    ),\n  });\n\n  const [value, updateValue] = React.useState<unknown>(\n    isUndefined(defaultValue)\n      ? control._getWatch(name as InternalFieldName)\n      : defaultValue,\n  );\n\n  React.useEffect(() => control._removeUnmounted());\n\n  return value;\n}\n","import React from 'react';\n\nimport getEventValue from './logic/getEventValue';\nimport isNameInFieldArray from './logic/isNameInFieldArray';\nimport get from './utils/get';\nimport { EVENTS } from './constants';\nimport {\n  ControllerFieldState,\n  Field,\n  FieldPath,\n  FieldPathValue,\n  FieldValues,\n  InternalFieldName,\n  UseControllerProps,\n  UseControllerReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useFormState } from './useFormState';\nimport { useWatch } from './useWatch';\n\n/**\n * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)\n *\n * @param props - the path name to the form field value, and validation rules.\n *\n * @returns field properties, field and form state. {@link UseControllerReturn}\n *\n * @example\n * ```tsx\n * function Input(props) {\n *   const { field, fieldState, formState } = useController(props);\n *   return (\n *     <div>\n *       <input {...field} placeholder={props.name} />\n *       <p>{fieldState.isTouched && \"Touched\"}</p>\n *       <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\n *     </div>\n *   );\n * }\n * ```\n */\nexport function useController<\n  TFieldValues extends FieldValues = FieldValues,\n  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(\n  props: UseControllerProps<TFieldValues, TName>,\n): UseControllerReturn<TFieldValues, TName> {\n  const methods = useFormContext<TFieldValues>();\n  const { name, control = methods.control, shouldUnregister } = props;\n  const isArrayField = isNameInFieldArray(control._names.array, name);\n  const value = useWatch({\n    control,\n    name,\n    defaultValue: get(\n      control._formValues,\n      name,\n      get(control._defaultValues, name, props.defaultValue),\n    ),\n    exact: true,\n  }) as FieldPathValue<TFieldValues, TName>;\n  const formState = useFormState({\n    control,\n    name,\n  });\n\n  const _registerProps = React.useRef(\n    control.register(name, {\n      ...props.rules,\n      value,\n    }),\n  );\n\n  React.useEffect(() => {\n    const updateMounted = (name: InternalFieldName, value: boolean) => {\n      const field: Field = get(control._fields, name);\n\n      if (field) {\n        field._f.mount = value;\n      }\n    };\n\n    updateMounted(name, true);\n\n    return () => {\n      const _shouldUnregisterField =\n        control._options.shouldUnregister || shouldUnregister;\n\n      (\n        isArrayField\n          ? _shouldUnregisterField && !control._stateFlags.action\n          : _shouldUnregisterField\n      )\n        ? control.unregister(name)\n        : updateMounted(name, false);\n    };\n  }, [name, control, isArrayField, shouldUnregister]);\n\n  return {\n    field: {\n      name,\n      value,\n      onChange: React.useCallback(\n        (event) =>\n          _registerProps.current.onChange({\n            target: {\n              value: getEventValue(event),\n              name: name as InternalFieldName,\n            },\n            type: EVENTS.CHANGE,\n          }),\n        [name],\n      ),\n      onBlur: React.useCallback(\n        () =>\n          _registerProps.current.onBlur({\n            target: {\n              value: get(control._formValues, name),\n              name: name as InternalFieldName,\n            },\n            type: EVENTS.BLUR,\n          }),\n        [name, control],\n      ),\n      ref: (elm) => {\n        const field = get(control._fields, name);\n\n        if (field && elm) {\n          field._f.ref = {\n            focus: () => elm.focus(),\n            select: () => elm.select(),\n            setCustomValidity: (message: string) =>\n              elm.setCustomValidity(message),\n            reportValidity: () => elm.reportValidity(),\n          };\n        }\n      },\n    },\n    formState,\n    fieldState: Object.defineProperties(\n      {},\n      {\n        invalid: {\n          enumerable: true,\n          get: () => !!get(formState.errors, name),\n        },\n        isDirty: {\n          enumerable: true,\n          get: () => !!get(formState.dirtyFields, name),\n        },\n        isTouched: {\n          enumerable: true,\n          get: () => !!get(formState.touchedFields, name),\n        },\n        error: {\n          enumerable: true,\n          get: () => get(formState.errors, name),\n        },\n      },\n    ) as ControllerFieldState,\n  };\n}\n","import { ControllerProps, FieldPath, FieldValues } from './types';\nimport { useController } from './useController';\n\n/**\n * Component based on `useController` hook to work with controlled component.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA)\n *\n * @param props - the path name to the form field value, and validation rules.\n *\n * @returns provide field handler functions, field and form state.\n *\n * @example\n * ```tsx\n * function App() {\n *   const { control } = useForm<FormValues>({\n *     defaultValues: {\n *       test: \"\"\n *     }\n *   });\n *\n *   return (\n *     <form>\n *       <Controller\n *         control={control}\n *         name=\"test\"\n *         render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (\n *           <>\n *             <input\n *               onChange={onChange} // send value to hook form\n *               onBlur={onBlur} // notify when input is touched\n *               value={value} // return updated value\n *               ref={ref} // set ref for focus management\n *             />\n *             <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\n *             <p>{fieldState.isTouched ? \"touched\" : \"\"}</p>\n *           </>\n *         )}\n *       />\n *     </form>\n *   );\n * }\n * ```\n */\nconst Controller = <\n  TFieldValues extends FieldValues = FieldValues,\n  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(\n  props: ControllerProps<TFieldValues, TName>,\n) => props.render(useController<TFieldValues, TName>(props));\n\nexport { Controller };\n","import {\n  InternalFieldErrors,\n  InternalFieldName,\n  ValidateResult,\n} from '../types';\n\nexport default (\n  name: InternalFieldName,\n  validateAllFieldCriteria: boolean,\n  errors: InternalFieldErrors,\n  type: string,\n  message: ValidateResult,\n) =>\n  validateAllFieldCriteria\n    ? {\n        ...errors[name],\n        types: {\n          ...(errors[name] && errors[name]!.types ? errors[name]!.types : {}),\n          [type]: message || true,\n        },\n      }\n    : {};\n","export default (value: string) => /^\\w*$/.test(value);\n","import compact from './compact';\n\nexport default (input: string): string[] =>\n  compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n","import { FieldValues } from '../types';\n\nimport isKey from './isKey';\nimport isObject from './isObject';\nimport stringToPath from './stringToPath';\n\nexport default function set(\n  object: FieldValues,\n  path: string,\n  value?: unknown,\n) {\n  let index = -1;\n  const tempPath = isKey(path) ? [path] : stringToPath(path);\n  const length = tempPath.length;\n  const lastIndex = length - 1;\n\n  while (++index < length) {\n    const key = tempPath[index];\n    let newValue = value;\n\n    if (index !== lastIndex) {\n      const objValue = object[key];\n      newValue =\n        isObject(objValue) || Array.isArray(objValue)\n          ? objValue\n          : !isNaN(+tempPath[index + 1])\n          ? []\n          : {};\n    }\n    object[key] = newValue;\n    object = object[key];\n  }\n  return object;\n}\n","import { FieldRefs, InternalFieldName } from '../types';\nimport { get } from '../utils';\nimport isObject from '../utils/isObject';\n\nconst focusFieldBy = (\n  fields: FieldRefs,\n  callback: (name?: string) => boolean,\n  fieldsNames?: Set<InternalFieldName> | InternalFieldName[],\n) => {\n  for (const key of fieldsNames || Object.keys(fields)) {\n    const field = get(fields, key);\n\n    if (field) {\n      const { _f, ...currentField } = field;\n\n      if (_f && callback(_f.name)) {\n        if (_f.ref.focus) {\n          _f.ref.focus();\n          break;\n        } else if (_f.refs && _f.refs[0].focus) {\n          _f.refs[0].focus();\n          break;\n        }\n      } else if (isObject(currentField)) {\n        focusFieldBy(currentField, callback);\n      }\n    }\n  }\n};\n\nexport default focusFieldBy;\n","export default () => {\n  const d =\n    typeof performance === 'undefined' ? Date.now() : performance.now() * 1000;\n\n  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n    const r = (Math.random() * 16 + d) % 16 | 0;\n\n    return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);\n  });\n};\n","import { FieldArrayMethodProps, InternalFieldName } from '../types';\nimport isUndefined from '../utils/isUndefined';\n\nexport default (\n  name: InternalFieldName,\n  index: number,\n  options: FieldArrayMethodProps = {},\n): string =>\n  options.shouldFocus || isUndefined(options.shouldFocus)\n    ? options.focusName ||\n      `${name}.${isUndefined(options.focusIndex) ? index : options.focusIndex}.`\n    : '';\n","import { InternalFieldName, Names } from '../types';\n\nexport default (\n  name: InternalFieldName,\n  _names: Names,\n  isBlurEvent?: boolean,\n) =>\n  !isBlurEvent &&\n  (_names.watchAll ||\n    _names.watch.has(name) ||\n    [..._names.watch].some(\n      (watchName) =>\n        name.startsWith(watchName) &&\n        /^\\.\\w+/.test(name.slice(watchName.length)),\n    ));\n","import {\n  FieldError,\n  FieldErrors,\n  FieldValues,\n  InternalFieldName,\n} from '../types';\nimport compact from '../utils/compact';\nimport get from '../utils/get';\nimport set from '../utils/set';\n\nexport default <T extends FieldValues = FieldValues>(\n  errors: FieldErrors<T>,\n  error: Partial<Record<string, FieldError>>,\n  name: InternalFieldName,\n): FieldErrors<T> => {\n  const fieldArrayErrors = compact(get(errors, name));\n  set(fieldArrayErrors, 'root', error[name]);\n  set(errors, name, fieldArrayErrors);\n  return errors;\n};\n","export default (value: unknown): value is boolean => typeof value === 'boolean';\n","import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLInputElement =>\n  element.type === 'file';\n","import React from 'react';\n\nimport { Message } from '../types';\nimport isString from '../utils/isString';\n\nexport default (value: unknown): value is Message =>\n  isString(value) || React.isValidElement(value as JSX.Element);\n","import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLInputElement =>\n  element.type === 'radio';\n","export default (value: unknown): value is RegExp => value instanceof RegExp;\n","import isUndefined from '../utils/isUndefined';\n\ntype CheckboxFieldResult = {\n  isValid: boolean;\n  value: string | string[] | boolean | undefined;\n};\n\nconst defaultResult: CheckboxFieldResult = {\n  value: false,\n  isValid: false,\n};\n\nconst validResult = { value: true, isValid: true };\n\nexport default (options?: HTMLInputElement[]): CheckboxFieldResult => {\n  if (Array.isArray(options)) {\n    if (options.length > 1) {\n      const values = options\n        .filter((option) => option && option.checked && !option.disabled)\n        .map((option) => option.value);\n      return { value: values, isValid: !!values.length };\n    }\n\n    return options[0].checked && !options[0].disabled\n      ? // @ts-expect-error expected to work in the browser\n        options[0].attributes && !isUndefined(options[0].attributes.value)\n        ? isUndefined(options[0].value) || options[0].value === ''\n          ? validResult\n          : { value: options[0].value, isValid: true }\n        : validResult\n      : defaultResult;\n  }\n\n  return defaultResult;\n};\n","type RadioFieldResult = {\n  isValid: boolean;\n  value: number | string | null;\n};\n\nconst defaultReturn: RadioFieldResult = {\n  isValid: false,\n  value: null,\n};\n\nexport default (options?: HTMLInputElement[]): RadioFieldResult =>\n  Array.isArray(options)\n    ? options.reduce(\n        (previous, option): RadioFieldResult =>\n          option && option.checked && !option.disabled\n            ? {\n                isValid: true,\n                value: option.value,\n              }\n            : previous,\n        defaultReturn,\n      )\n    : defaultReturn;\n","import { FieldError, Ref, ValidateResult } from '../types';\nimport isBoolean from '../utils/isBoolean';\nimport isMessage from '../utils/isMessage';\n\nexport default function getValidateError(\n  result: ValidateResult,\n  ref: Ref,\n  type = 'validate',\n): FieldError | void {\n  if (\n    isMessage(result) ||\n    (Array.isArray(result) && result.every(isMessage)) ||\n    (isBoolean(result) && !result)\n  ) {\n    return {\n      type,\n      message: isMessage(result) ? result : '',\n      ref,\n    };\n  }\n}\n","import { ValidationRule } from '../types';\nimport isObject from '../utils/isObject';\nimport isRegex from '../utils/isRegex';\n\nexport default (validationData?: ValidationRule) =>\n  isObject(validationData) && !isRegex(validationData)\n    ? validationData\n    : {\n        value: validationData,\n        message: '',\n      };\n","import { INPUT_VALIDATION_RULES } from '../constants';\nimport {\n  Field,\n  FieldError,\n  InternalFieldErrors,\n  Message,\n  NativeFieldValue,\n} from '../types';\nimport isBoolean from '../utils/isBoolean';\nimport isCheckBoxInput from '../utils/isCheckBoxInput';\nimport isEmptyObject from '../utils/isEmptyObject';\nimport isFileInput from '../utils/isFileInput';\nimport isFunction from '../utils/isFunction';\nimport isMessage from '../utils/isMessage';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport isObject from '../utils/isObject';\nimport isRadioInput from '../utils/isRadioInput';\nimport isRegex from '../utils/isRegex';\nimport isString from '../utils/isString';\n\nimport appendErrors from './appendErrors';\nimport getCheckboxValue from './getCheckboxValue';\nimport getRadioValue from './getRadioValue';\nimport getValidateError from './getValidateError';\nimport getValueAndMessage from './getValueAndMessage';\n\nexport default async <T extends NativeFieldValue>(\n  field: Field,\n  inputValue: T,\n  validateAllFieldCriteria: boolean,\n  shouldUseNativeValidation?: boolean,\n  isFieldArray?: boolean,\n): Promise<InternalFieldErrors> => {\n  const {\n    ref,\n    refs,\n    required,\n    maxLength,\n    minLength,\n    min,\n    max,\n    pattern,\n    validate,\n    name,\n    valueAsNumber,\n    mount,\n    disabled,\n  } = field._f;\n  if (!mount || disabled) {\n    return {};\n  }\n  const inputRef: HTMLInputElement = refs ? refs[0] : (ref as HTMLInputElement);\n  const setCustomValidity = (message?: string | boolean) => {\n    if (shouldUseNativeValidation && inputRef.reportValidity) {\n      inputRef.setCustomValidity(isBoolean(message) ? '' : message || ' ');\n      inputRef.reportValidity();\n    }\n  };\n  const error: InternalFieldErrors = {};\n  const isRadio = isRadioInput(ref);\n  const isCheckBox = isCheckBoxInput(ref);\n  const isRadioOrCheckbox = isRadio || isCheckBox;\n  const isEmpty =\n    ((valueAsNumber || isFileInput(ref)) && !ref.value) ||\n    inputValue === '' ||\n    (Array.isArray(inputValue) && !inputValue.length);\n  const appendErrorsCurry = appendErrors.bind(\n    null,\n    name,\n    validateAllFieldCriteria,\n    error,\n  );\n  const getMinMaxMessage = (\n    exceedMax: boolean,\n    maxLengthMessage: Message,\n    minLengthMessage: Message,\n    maxType = INPUT_VALIDATION_RULES.maxLength,\n    minType = INPUT_VALIDATION_RULES.minLength,\n  ) => {\n    const message = exceedMax ? maxLengthMessage : minLengthMessage;\n    error[name] = {\n      type: exceedMax ? maxType : minType,\n      message,\n      ref,\n      ...appendErrorsCurry(exceedMax ? maxType : minType, message),\n    };\n  };\n\n  if (\n    isFieldArray\n      ? !Array.isArray(inputValue) || !inputValue.length\n      : required &&\n        ((!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue))) ||\n          (isBoolean(inputValue) && !inputValue) ||\n          (isCheckBox && !getCheckboxValue(refs).isValid) ||\n          (isRadio && !getRadioValue(refs).isValid))\n  ) {\n    const { value, message } = isMessage(required)\n      ? { value: !!required, message: required }\n      : getValueAndMessage(required);\n\n    if (value) {\n      error[name] = {\n        type: INPUT_VALIDATION_RULES.required,\n        message,\n        ref: inputRef,\n        ...appendErrorsCurry(INPUT_VALIDATION_RULES.required, message),\n      };\n      if (!validateAllFieldCriteria) {\n        setCustomValidity(message);\n        return error;\n      }\n    }\n  }\n\n  if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {\n    let exceedMax;\n    let exceedMin;\n    const maxOutput = getValueAndMessage(max);\n    const minOutput = getValueAndMessage(min);\n\n    if (!isNullOrUndefined(inputValue) && !isNaN(inputValue as number)) {\n      const valueNumber =\n        (ref as HTMLInputElement).valueAsNumber ||\n        (inputValue ? +inputValue : inputValue);\n      if (!isNullOrUndefined(maxOutput.value)) {\n        exceedMax = valueNumber > maxOutput.value;\n      }\n      if (!isNullOrUndefined(minOutput.value)) {\n        exceedMin = valueNumber < minOutput.value;\n      }\n    } else {\n      const valueDate =\n        (ref as HTMLInputElement).valueAsDate || new Date(inputValue as string);\n      const convertTimeToDate = (time: unknown) =>\n        new Date(new Date().toDateString() + ' ' + time);\n      const isTime = ref.type == 'time';\n      const isWeek = ref.type == 'week';\n\n      if (isString(maxOutput.value) && inputValue) {\n        exceedMax = isTime\n          ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value)\n          : isWeek\n          ? inputValue > maxOutput.value\n          : valueDate > new Date(maxOutput.value);\n      }\n\n      if (isString(minOutput.value) && inputValue) {\n        exceedMin = isTime\n          ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value)\n          : isWeek\n          ? inputValue < minOutput.value\n          : valueDate < new Date(minOutput.value);\n      }\n    }\n\n    if (exceedMax || exceedMin) {\n      getMinMaxMessage(\n        !!exceedMax,\n        maxOutput.message,\n        minOutput.message,\n        INPUT_VALIDATION_RULES.max,\n        INPUT_VALIDATION_RULES.min,\n      );\n      if (!validateAllFieldCriteria) {\n        setCustomValidity(error[name]!.message);\n        return error;\n      }\n    }\n  }\n\n  if (\n    (maxLength || minLength) &&\n    !isEmpty &&\n    (isString(inputValue) || (isFieldArray && Array.isArray(inputValue)))\n  ) {\n    const maxLengthOutput = getValueAndMessage(maxLength);\n    const minLengthOutput = getValueAndMessage(minLength);\n    const exceedMax =\n      !isNullOrUndefined(maxLengthOutput.value) &&\n      inputValue.length > maxLengthOutput.value;\n    const exceedMin =\n      !isNullOrUndefined(minLengthOutput.value) &&\n      inputValue.length < minLengthOutput.value;\n\n    if (exceedMax || exceedMin) {\n      getMinMaxMessage(\n        exceedMax,\n        maxLengthOutput.message,\n        minLengthOutput.message,\n      );\n      if (!validateAllFieldCriteria) {\n        setCustomValidity(error[name]!.message);\n        return error;\n      }\n    }\n  }\n\n  if (pattern && !isEmpty && isString(inputValue)) {\n    const { value: patternValue, message } = getValueAndMessage(pattern);\n\n    if (isRegex(patternValue) && !inputValue.match(patternValue)) {\n      error[name] = {\n        type: INPUT_VALIDATION_RULES.pattern,\n        message,\n        ref,\n        ...appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message),\n      };\n      if (!validateAllFieldCriteria) {\n        setCustomValidity(message);\n        return error;\n      }\n    }\n  }\n\n  if (validate) {\n    if (isFunction(validate)) {\n      const result = await validate(inputValue);\n      const validateError = getValidateError(result, inputRef);\n\n      if (validateError) {\n        error[name] = {\n          ...validateError,\n          ...appendErrorsCurry(\n            INPUT_VALIDATION_RULES.validate,\n            validateError.message,\n          ),\n        };\n        if (!validateAllFieldCriteria) {\n          setCustomValidity(validateError.message);\n          return error;\n        }\n      }\n    } else if (isObject(validate)) {\n      let validationResult = {} as FieldError;\n\n      for (const key in validate) {\n        if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {\n          break;\n        }\n\n        const validateError = getValidateError(\n          await validate[key](inputValue),\n          inputRef,\n          key,\n        );\n\n        if (validateError) {\n          validationResult = {\n            ...validateError,\n            ...appendErrorsCurry(key, validateError.message),\n          };\n\n          setCustomValidity(validateError.message);\n\n          if (validateAllFieldCriteria) {\n            error[name] = validationResult;\n          }\n        }\n      }\n\n      if (!isEmptyObject(validationResult)) {\n        error[name] = {\n          ref: inputRef,\n          ...validationResult,\n        };\n        if (!validateAllFieldCriteria) {\n          return error;\n        }\n      }\n    }\n  }\n\n  setCustomValidity(true);\n  return error;\n};\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function append<T>(data: T[], value: T | T[]): T[] {\n  return [...data, ...convertToArrayPayload(value)];\n}\n","import isObject from './isObject';\n\nexport default (tempObject: object) => {\n  const prototypeCopy =\n    tempObject.constructor && tempObject.constructor.prototype;\n\n  return (\n    isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf')\n  );\n};\n","export default typeof window !== 'undefined' &&\n  typeof window.HTMLElement !== 'undefined' &&\n  typeof document !== 'undefined';\n","import isObject from './isObject';\nimport isPlainObject from './isPlainObject';\nimport isWeb from './isWeb';\n\nexport default function cloneObject<T>(data: T): T {\n  let copy: any;\n  const isArray = Array.isArray(data);\n\n  if (data instanceof Date) {\n    copy = new Date(data);\n  } else if (data instanceof Set) {\n    copy = new Set(data);\n  } else if (\n    !(isWeb && (data instanceof Blob || data instanceof FileList)) &&\n    (isArray || isObject(data))\n  ) {\n    copy = isArray ? [] : {};\n\n    if (!Array.isArray(data) && !isPlainObject(data)) {\n      copy = data;\n    } else {\n      for (const key in data) {\n        copy[key] = cloneObject(data[key]);\n      }\n    }\n  } else {\n    return data;\n  }\n\n  return copy;\n}\n","export default <T>(value: T | T[]): undefined[] | undefined =>\n  Array.isArray(value) ? value.map(() => undefined) : undefined;\n","import { VALIDATION_MODE } from '../constants';\nimport { Mode } from '../types';\n\nexport default (\n  mode?: Mode,\n): {\n  isOnSubmit: boolean;\n  isOnBlur: boolean;\n  isOnChange: boolean;\n  isOnAll: boolean;\n  isOnTouch: boolean;\n} => ({\n  isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\n  isOnBlur: mode === VALIDATION_MODE.onBlur,\n  isOnChange: mode === VALIDATION_MODE.onChange,\n  isOnAll: mode === VALIDATION_MODE.all,\n  isOnTouch: mode === VALIDATION_MODE.onTouched,\n});\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function insert<T>(data: T[], index: number): (T | undefined)[];\nexport default function insert<T>(\n  data: T[],\n  index: number,\n  value: T | T[],\n): T[];\nexport default function insert<T>(\n  data: T[],\n  index: number,\n  value?: T | T[],\n): (T | undefined)[] {\n  return [\n    ...data.slice(0, index),\n    ...convertToArrayPayload(value),\n    ...data.slice(index),\n  ];\n}\n","import isUndefined from './isUndefined';\n\nexport default <T>(\n  data: (T | undefined)[],\n  from: number,\n  to: number,\n): (T | undefined)[] => {\n  if (!Array.isArray(data)) {\n    return [];\n  }\n\n  if (isUndefined(data[to])) {\n    data[to] = undefined;\n  }\n  data.splice(to, 0, data.splice(from, 1)[0]);\n\n  return data;\n};\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function prepend<T>(data: T[], value: T | T[]): T[] {\n  return [...convertToArrayPayload(value), ...convertToArrayPayload(data)];\n}\n","import compact from './compact';\nimport convertToArrayPayload from './convertToArrayPayload';\nimport isUndefined from './isUndefined';\n\nfunction removeAtIndexes<T>(data: T[], indexes: number[]): T[] {\n  let i = 0;\n  const temp = [...data];\n\n  for (const index of indexes) {\n    temp.splice(index - i, 1);\n    i++;\n  }\n\n  return compact(temp).length ? temp : [];\n}\n\nexport default <T>(data: T[], index?: number | number[]): T[] =>\n  isUndefined(index)\n    ? []\n    : removeAtIndexes(\n        data,\n        (convertToArrayPayload(index) as number[]).sort((a, b) => a - b),\n      );\n","export default <T>(data: T[], indexA: number, indexB: number): void => {\n  data[indexA] = [data[indexB], (data[indexB] = data[indexA])][0];\n};\n","import isEmptyObject from './isEmptyObject';\nimport isKey from './isKey';\nimport isObject from './isObject';\nimport isUndefined from './isUndefined';\nimport stringToPath from './stringToPath';\n\nfunction baseGet(object: any, updatePath: (string | number)[]) {\n  const length = updatePath.slice(0, -1).length;\n  let index = 0;\n\n  while (index < length) {\n    object = isUndefined(object) ? index++ : object[updatePath[index++]];\n  }\n\n  return object;\n}\n\nfunction isEmptyArray(obj: unknown[]) {\n  for (const key in obj) {\n    if (!isUndefined(obj[key])) {\n      return false;\n    }\n  }\n  return true;\n}\n\nexport default function unset(object: any, path: string) {\n  const updatePath = isKey(path) ? [path] : stringToPath(path);\n  const childObject =\n    updatePath.length == 1 ? object : baseGet(object, updatePath);\n  const key = updatePath[updatePath.length - 1];\n  let previousObjRef;\n\n  if (childObject) {\n    delete childObject[key];\n  }\n\n  for (let k = 0; k < updatePath.slice(0, -1).length; k++) {\n    let index = -1;\n    let objectRef;\n    const currentPaths = updatePath.slice(0, -(k + 1));\n    const currentPathsLength = currentPaths.length - 1;\n\n    if (k > 0) {\n      previousObjRef = object;\n    }\n\n    while (++index < currentPaths.length) {\n      const item = currentPaths[index];\n      objectRef = objectRef ? objectRef[item] : object[item];\n\n      if (\n        currentPathsLength === index &&\n        ((isObject(objectRef) && isEmptyObject(objectRef)) ||\n          (Array.isArray(objectRef) && isEmptyArray(objectRef)))\n      ) {\n        previousObjRef ? delete previousObjRef[item] : delete object[item];\n      }\n\n      previousObjRef = objectRef;\n    }\n  }\n\n  return object;\n}\n","export default <T>(fieldValues: T[], index: number, value: T) => {\n  fieldValues[index] = value;\n  return fieldValues;\n};\n","import React from 'react';\n\nimport focusFieldBy from './logic/focusFieldBy';\nimport generateId from './logic/generateId';\nimport getFocusFieldName from './logic/getFocusFieldName';\nimport isWatched from './logic/isWatched';\nimport updateFieldArrayRootError from './logic/updateFieldArrayRootError';\nimport validateField from './logic/validateField';\nimport appendAt from './utils/append';\nimport cloneObject from './utils/cloneObject';\nimport convertToArrayPayload from './utils/convertToArrayPayload';\nimport fillEmptyArray from './utils/fillEmptyArray';\nimport get from './utils/get';\nimport getValidationModes from './utils/getValidationModes';\nimport insertAt from './utils/insert';\nimport isEmptyObject from './utils/isEmptyObject';\nimport moveArrayAt from './utils/move';\nimport prependAt from './utils/prepend';\nimport removeArrayAt from './utils/remove';\nimport set from './utils/set';\nimport swapArrayAt from './utils/swap';\nimport unset from './utils/unset';\nimport updateAt from './utils/update';\nimport { VALIDATION_MODE } from './constants';\nimport {\n  Control,\n  Field,\n  FieldArray,\n  FieldArrayMethodProps,\n  FieldArrayPath,\n  FieldArrayWithId,\n  FieldErrors,\n  FieldPath,\n  FieldValues,\n  InternalFieldName,\n  RegisterOptions,\n  UseFieldArrayProps,\n  UseFieldArrayReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * A custom hook that exposes convenient methods to perform operations with a list of dynamic inputs that need to be appended, updated, removed etc. • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn) • [Video](https://youtu.be/4MrbfGSFY2A)\n *\n * @remarks\n * [API](https://react-hook-form.com/api/usefieldarray) • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn)\n *\n * @param props - useFieldArray props\n *\n * @returns methods - functions to manipulate with the Field Arrays (dynamic inputs) {@link UseFieldArrayReturn}\n *\n * @example\n * ```tsx\n * function App() {\n *   const { register, control, handleSubmit, reset, trigger, setError } = useForm({\n *     defaultValues: {\n *       test: []\n *     }\n *   });\n *   const { fields, append } = useFieldArray({\n *     control,\n *     name: \"test\"\n *   });\n *\n *   return (\n *     <form onSubmit={handleSubmit(data => console.log(data))}>\n *       {fields.map((item, index) => (\n *          <input key={item.id} {...register(`test.${index}.firstName`)}  />\n *       ))}\n *       <button type=\"button\" onClick={() => append({ firstName: \"bill\" })}>\n *         append\n *       </button>\n *       <input type=\"submit\" />\n *     </form>\n *   );\n * }\n * ```\n */\nexport function useFieldArray<\n  TFieldValues extends FieldValues = FieldValues,\n  TFieldArrayName extends FieldArrayPath<TFieldValues> = FieldArrayPath<TFieldValues>,\n  TKeyName extends string = 'id',\n>(\n  props: UseFieldArrayProps<TFieldValues, TFieldArrayName, TKeyName>,\n): UseFieldArrayReturn<TFieldValues, TFieldArrayName, TKeyName> {\n  const methods = useFormContext();\n  const {\n    control = methods.control,\n    name,\n    keyName = 'id',\n    shouldUnregister,\n  } = props;\n  const [fields, setFields] = React.useState(control._getFieldArray(name));\n  const ids = React.useRef<string[]>(\n    control._getFieldArray(name).map(generateId),\n  );\n  const _fieldIds = React.useRef(fields);\n  const _name = React.useRef(name);\n  const _actioned = React.useRef(false);\n\n  _name.current = name;\n  _fieldIds.current = fields;\n  control._names.array.add(name);\n\n  props.rules &&\n    (control as Control).register(\n      name as FieldPath<TFieldValues>,\n      props.rules as RegisterOptions<TFieldValues>,\n    );\n\n  const callback = React.useCallback(\n    ({\n      values,\n      name: fieldArrayName,\n    }: {\n      values?: FieldValues;\n      name?: InternalFieldName;\n    }) => {\n      if (fieldArrayName === _name.current || !fieldArrayName) {\n        const fieldValues = get(values, _name.current);\n        if (Array.isArray(fieldValues)) {\n          setFields(fieldValues);\n          ids.current = fieldValues.map(generateId);\n        }\n      }\n    },\n    [],\n  );\n\n  useSubscribe({\n    callback,\n    subject: control._subjects.array,\n  });\n\n  const updateValues = React.useCallback(\n    <\n      T extends Partial<\n        FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>\n      >[],\n    >(\n      updatedFieldArrayValues: T,\n    ) => {\n      _actioned.current = true;\n      control._updateFieldArray(name, updatedFieldArrayValues);\n    },\n    [control, name],\n  );\n\n  const append = (\n    value:\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n    options?: FieldArrayMethodProps,\n  ) => {\n    const appendValue = convertToArrayPayload(cloneObject(value));\n    const updatedFieldArrayValues = appendAt(\n      control._getFieldArray(name),\n      appendValue,\n    );\n    control._names.focus = getFocusFieldName(\n      name,\n      updatedFieldArrayValues.length - 1,\n      options,\n    );\n    ids.current = appendAt(ids.current, appendValue.map(generateId));\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, appendAt, {\n      argA: fillEmptyArray(value),\n    });\n  };\n\n  const prepend = (\n    value:\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n    options?: FieldArrayMethodProps,\n  ) => {\n    const prependValue = convertToArrayPayload(cloneObject(value));\n    const updatedFieldArrayValues = prependAt(\n      control._getFieldArray(name),\n      prependValue,\n    );\n    control._names.focus = getFocusFieldName(name, 0, options);\n    ids.current = prependAt(ids.current, prependValue.map(generateId));\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, prependAt, {\n      argA: fillEmptyArray(value),\n    });\n  };\n\n  const remove = (index?: number | number[]) => {\n    const updatedFieldArrayValues: Partial<\n      FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>\n    >[] = removeArrayAt(control._getFieldArray(name), index);\n    ids.current = removeArrayAt(ids.current, index);\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, removeArrayAt, {\n      argA: index,\n    });\n  };\n\n  const insert = (\n    index: number,\n    value:\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n    options?: FieldArrayMethodProps,\n  ) => {\n    const insertValue = convertToArrayPayload(cloneObject(value));\n    const updatedFieldArrayValues = insertAt(\n      control._getFieldArray(name),\n      index,\n      insertValue,\n    );\n    control._names.focus = getFocusFieldName(name, index, options);\n    ids.current = insertAt(ids.current, index, insertValue.map(generateId));\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(name, updatedFieldArrayValues, insertAt, {\n      argA: index,\n      argB: fillEmptyArray(value),\n    });\n  };\n\n  const swap = (indexA: number, indexB: number) => {\n    const updatedFieldArrayValues = control._getFieldArray(name);\n    swapArrayAt(updatedFieldArrayValues, indexA, indexB);\n    swapArrayAt(ids.current, indexA, indexB);\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(\n      name,\n      updatedFieldArrayValues,\n      swapArrayAt,\n      {\n        argA: indexA,\n        argB: indexB,\n      },\n      false,\n    );\n  };\n\n  const move = (from: number, to: number) => {\n    const updatedFieldArrayValues = control._getFieldArray(name);\n    moveArrayAt(updatedFieldArrayValues, from, to);\n    moveArrayAt(ids.current, from, to);\n    updateValues(updatedFieldArrayValues);\n    setFields(updatedFieldArrayValues);\n    control._updateFieldArray(\n      name,\n      updatedFieldArrayValues,\n      moveArrayAt,\n      {\n        argA: from,\n        argB: to,\n      },\n      false,\n    );\n  };\n\n  const update = (\n    index: number,\n    value: FieldArray<TFieldValues, TFieldArrayName>,\n  ) => {\n    const updateValue = cloneObject(value);\n    const updatedFieldArrayValues = updateAt(\n      control._getFieldArray<\n        FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>\n      >(name),\n      index,\n      updateValue as FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>,\n    );\n    ids.current = [...updatedFieldArrayValues].map((item, i) =>\n      !item || i === index ? generateId() : ids.current[i],\n    );\n    updateValues(updatedFieldArrayValues);\n    setFields([...updatedFieldArrayValues]);\n    control._updateFieldArray(\n      name,\n      updatedFieldArrayValues,\n      updateAt,\n      {\n        argA: index,\n        argB: updateValue,\n      },\n      true,\n      false,\n    );\n  };\n\n  const replace = (\n    value:\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n      | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n  ) => {\n    const updatedFieldArrayValues = convertToArrayPayload(cloneObject(value));\n    ids.current = updatedFieldArrayValues.map(generateId);\n    updateValues([...updatedFieldArrayValues]);\n    setFields([...updatedFieldArrayValues]);\n    control._updateFieldArray(\n      name,\n      [...updatedFieldArrayValues],\n      <T>(data: T): T => data,\n      {},\n      true,\n      false,\n    );\n  };\n\n  React.useEffect(() => {\n    control._stateFlags.action = false;\n\n    isWatched(name, control._names) && control._subjects.state.next({});\n\n    if (\n      _actioned.current &&\n      (!getValidationModes(control._options.mode).isOnSubmit ||\n        control._formState.isSubmitted)\n    ) {\n      if (control._options.resolver) {\n        control._executeSchema([name]).then((result) => {\n          const error = get(result.errors, name);\n          const existingError = get(control._formState.errors, name);\n\n          if (\n            existingError ? !error && existingError.type : error && error.type\n          ) {\n            error\n              ? set(control._formState.errors, name, error)\n              : unset(control._formState.errors, name);\n            control._subjects.state.next({\n              errors: control._formState.errors as FieldErrors<TFieldValues>,\n            });\n          }\n        });\n      } else {\n        const field: Field = get(control._fields, name);\n        if (field && field._f) {\n          validateField(\n            field,\n            get(control._formValues, name),\n            control._options.criteriaMode === VALIDATION_MODE.all,\n            control._options.shouldUseNativeValidation,\n            true,\n          ).then(\n            (error) =>\n              !isEmptyObject(error) &&\n              control._subjects.state.next({\n                errors: updateFieldArrayRootError(\n                  control._formState.errors,\n                  error,\n                  name,\n                ) as FieldErrors<TFieldValues>,\n              }),\n          );\n        }\n      }\n    }\n\n    control._subjects.watch.next({\n      name,\n      values: control._formValues,\n    });\n\n    control._names.focus &&\n      focusFieldBy(\n        control._fields,\n        (key) => !!key && key.startsWith(control._names.focus),\n      );\n\n    control._names.focus = '';\n\n    control._proxyFormState.isValid && control._updateValid();\n  }, [fields, name, control]);\n\n  React.useEffect(() => {\n    !get(control._formValues, name) && control._updateFieldArray(name);\n\n    return () => {\n      (control._options.shouldUnregister || shouldUnregister) &&\n        control.unregister(name as FieldPath<TFieldValues>);\n    };\n  }, [name, control, keyName, shouldUnregister]);\n\n  return {\n    swap: React.useCallback(swap, [updateValues, name, control]),\n    move: React.useCallback(move, [updateValues, name, control]),\n    prepend: React.useCallback(prepend, [updateValues, name, control]),\n    append: React.useCallback(append, [updateValues, name, control]),\n    remove: React.useCallback(remove, [updateValues, name, control]),\n    insert: React.useCallback(insert, [updateValues, name, control]),\n    update: React.useCallback(update, [updateValues, name, control]),\n    replace: React.useCallback(replace, [updateValues, name, control]),\n    fields: React.useMemo(\n      () =>\n        fields.map((field, index) => ({\n          ...field,\n          [keyName]: ids.current[index] || generateId(),\n        })) as FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>[],\n      [fields, keyName],\n    ),\n  };\n}\n","import { Noop } from '../types';\n\nexport type Observer<T> = {\n  next: (value: T) => void;\n};\n\nexport type Subscription = {\n  unsubscribe: Noop;\n};\n\nexport type Subject<T> = {\n  readonly observers: Observer<T>[];\n  subscribe: (value: Observer<T>) => Subscription;\n  unsubscribe: Noop;\n} & Observer<T>;\n\nexport default function createSubject<T>(): Subject<T> {\n  let _observers: Observer<T>[] = [];\n\n  const next = (value: T) => {\n    for (const observer of _observers) {\n      observer.next(value);\n    }\n  };\n\n  const subscribe = (observer: Observer<T>): Subscription => {\n    _observers.push(observer);\n    return {\n      unsubscribe: () => {\n        _observers = _observers.filter((o) => o !== observer);\n      },\n    };\n  };\n\n  const unsubscribe = () => {\n    _observers = [];\n  };\n\n  return {\n    get observers() {\n      return _observers;\n    },\n    next,\n    subscribe,\n    unsubscribe,\n  };\n}\n","import { Primitive } from '../types';\n\nimport isNullOrUndefined from './isNullOrUndefined';\nimport { isObjectType } from './isObject';\n\nexport default (value: unknown): value is Primitive =>\n  isNullOrUndefined(value) || !isObjectType(value);\n","import isObject from '../utils/isObject';\n\nimport isDateObject from './isDateObject';\nimport isPrimitive from './isPrimitive';\n\nexport default function deepEqual(object1: any, object2: any) {\n  if (isPrimitive(object1) || isPrimitive(object2)) {\n    return object1 === object2;\n  }\n\n  if (isDateObject(object1) && isDateObject(object2)) {\n    return object1.getTime() === object2.getTime();\n  }\n\n  const keys1 = Object.keys(object1);\n  const keys2 = Object.keys(object2);\n\n  if (keys1.length !== keys2.length) {\n    return false;\n  }\n\n  for (const key of keys1) {\n    const val1 = object1[key];\n\n    if (!keys2.includes(key)) {\n      return false;\n    }\n\n    if (key !== 'ref') {\n      const val2 = object2[key];\n\n      if (\n        (isDateObject(val1) && isDateObject(val2)) ||\n        (isObject(val1) && isObject(val2)) ||\n        (Array.isArray(val1) && Array.isArray(val2))\n          ? !deepEqual(val1, val2)\n          : val1 !== val2\n      ) {\n        return false;\n      }\n    }\n  }\n\n  return true;\n}\n","export default (value: unknown): value is HTMLElement => {\n  const owner = value ? ((value as HTMLElement).ownerDocument as Document) : 0;\n  const ElementClass =\n    owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement;\n  return value instanceof ElementClass;\n};\n","import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLSelectElement =>\n  element.type === `select-multiple`;\n","import { FieldElement } from '../types';\n\nimport isCheckBoxInput from './isCheckBoxInput';\nimport isRadioInput from './isRadioInput';\n\nexport default (ref: FieldElement): ref is HTMLInputElement =>\n  isRadioInput(ref) || isCheckBoxInput(ref);\n","import { Ref } from '../types';\n\nimport isHTMLElement from './isHTMLElement';\n\nexport default (ref: Ref) => isHTMLElement(ref) && ref.isConnected;\n","import deepEqual from '../utils/deepEqual';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport isObject from '../utils/isObject';\nimport isPrimitive from '../utils/isPrimitive';\nimport isUndefined from '../utils/isUndefined';\nimport objectHasFunction from '../utils/objectHasFunction';\n\nfunction markFieldsDirty<U>(data: U, fields: Record<string, any> = {}) {\n  const isParentNodeArray = Array.isArray(data);\n\n  if (isObject(data) || isParentNodeArray) {\n    for (const key in data) {\n      if (\n        Array.isArray(data[key]) ||\n        (isObject(data[key]) && !objectHasFunction(data[key]))\n      ) {\n        fields[key] = Array.isArray(data[key]) ? [] : {};\n        markFieldsDirty(data[key], fields[key]);\n      } else if (!isNullOrUndefined(data[key])) {\n        fields[key] = true;\n      }\n    }\n  }\n\n  return fields;\n}\n\nfunction getDirtyFieldsFromDefaultValues<T>(\n  data: T,\n  formValues: T,\n  dirtyFieldsFromValues: any,\n) {\n  const isParentNodeArray = Array.isArray(data);\n\n  if (isObject(data) || isParentNodeArray) {\n    for (const key in data) {\n      if (\n        Array.isArray(data[key]) ||\n        (isObject(data[key]) && !objectHasFunction(data[key]))\n      ) {\n        if (\n          isUndefined(formValues) ||\n          isPrimitive(dirtyFieldsFromValues[key])\n        ) {\n          dirtyFieldsFromValues[key] = Array.isArray(data[key])\n            ? markFieldsDirty(data[key], [])\n            : { ...markFieldsDirty(data[key]) };\n        } else {\n          getDirtyFieldsFromDefaultValues(\n            data[key],\n            isNullOrUndefined(formValues) ? {} : formValues[key],\n            dirtyFieldsFromValues[key],\n          );\n        }\n      } else {\n        dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);\n      }\n    }\n  }\n\n  return dirtyFieldsFromValues;\n}\n\nexport default <T>(defaultValues: T, formValues: T) =>\n  getDirtyFieldsFromDefaultValues(\n    defaultValues,\n    formValues,\n    markFieldsDirty(formValues),\n  );\n","import { Field, NativeFieldValue } from '../types';\nimport isString from '../utils/isString';\nimport isUndefined from '../utils/isUndefined';\n\nexport default <T extends NativeFieldValue>(\n  value: T,\n  { valueAsNumber, valueAsDate, setValueAs }: Field['_f'],\n) =>\n  isUndefined(value)\n    ? value\n    : valueAsNumber\n    ? value === ''\n      ? NaN\n      : value\n      ? +value\n      : value\n    : valueAsDate && isString(value)\n    ? new Date(value)\n    : setValueAs\n    ? setValueAs(value)\n    : value;\n","import { Field } from '../types';\nimport isCheckBox from '../utils/isCheckBoxInput';\nimport isFileInput from '../utils/isFileInput';\nimport isMultipleSelect from '../utils/isMultipleSelect';\nimport isRadioInput from '../utils/isRadioInput';\nimport isUndefined from '../utils/isUndefined';\n\nimport getCheckboxValue from './getCheckboxValue';\nimport getFieldValueAs from './getFieldValueAs';\nimport getRadioValue from './getRadioValue';\n\nexport default function getFieldValue(_f: Field['_f']) {\n  const ref = _f.ref;\n\n  if (_f.refs ? _f.refs.every((ref) => ref.disabled) : ref.disabled) {\n    return;\n  }\n\n  if (isFileInput(ref)) {\n    return ref.files;\n  }\n\n  if (isRadioInput(ref)) {\n    return getRadioValue(_f.refs).value;\n  }\n\n  if (isMultipleSelect(ref)) {\n    return [...ref.selectedOptions].map(({ value }) => value);\n  }\n\n  if (isCheckBox(ref)) {\n    return getCheckboxValue(_f.refs).value;\n  }\n\n  return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);\n}\n","import {\n  CriteriaMode,\n  Field,\n  FieldName,\n  FieldRefs,\n  FieldValues,\n  InternalFieldName,\n} from '../types';\nimport { get } from '../utils';\nimport set from '../utils/set';\n\nexport default <TFieldValues extends FieldValues>(\n  fieldsNames: Set<InternalFieldName> | InternalFieldName[],\n  _fields: FieldRefs,\n  criteriaMode?: CriteriaMode,\n  shouldUseNativeValidation?: boolean | undefined,\n) => {\n  const fields: Record<InternalFieldName, Field['_f']> = {};\n\n  for (const name of fieldsNames) {\n    const field: Field = get(_fields, name);\n\n    field && set(fields, name, field._f);\n  }\n\n  return {\n    criteriaMode,\n    names: [...fieldsNames] as FieldName<TFieldValues>[],\n    fields,\n    shouldUseNativeValidation,\n  };\n};\n","import {\n  ValidationRule,\n  ValidationValue,\n  ValidationValueMessage,\n} from '../types';\nimport isObject from '../utils/isObject';\nimport isRegex from '../utils/isRegex';\nimport isUndefined from '../utils/isUndefined';\n\nexport default <T extends ValidationValue>(\n  rule?: ValidationRule<T> | ValidationValueMessage<T>,\n) =>\n  isUndefined(rule)\n    ? undefined\n    : isRegex(rule)\n    ? rule.source\n    : isObject(rule)\n    ? isRegex(rule.value)\n      ? rule.value.source\n      : rule.value\n    : rule;\n","import { Field } from '../types';\n\nexport default (options: Field['_f']) =>\n  options.mount &&\n  (options.required ||\n    options.min ||\n    options.max ||\n    options.maxLength ||\n    options.minLength ||\n    options.pattern ||\n    options.validate);\n","import { FieldError, FieldErrors, FieldValues } from '../types';\nimport get from '../utils/get';\nimport isKey from '../utils/isKey';\n\nexport default function schemaErrorLookup<T extends FieldValues = FieldValues>(\n  errors: FieldErrors<T>,\n  _fields: FieldValues,\n  name: string,\n): {\n  error?: FieldError;\n  name: string;\n} {\n  const error = get(errors, name);\n\n  if (error || isKey(name)) {\n    return {\n      error,\n      name,\n    };\n  }\n\n  const names = name.split('.');\n\n  while (names.length) {\n    const fieldName = names.join('.');\n    const field = get(_fields, fieldName);\n    const foundError = get(errors, fieldName);\n\n    if (field && !Array.isArray(field) && name !== fieldName) {\n      return { name };\n    }\n\n    if (foundError && foundError.type) {\n      return {\n        name: fieldName,\n        error: foundError,\n      };\n    }\n\n    names.pop();\n  }\n\n  return {\n    name,\n  };\n}\n","export default (\n  isBlurEvent: boolean,\n  isTouched: boolean,\n  isSubmitted: boolean,\n  reValidateMode: {\n    isOnBlur: boolean;\n    isOnChange: boolean;\n  },\n  mode: Partial<{\n    isOnSubmit: boolean;\n    isOnBlur: boolean;\n    isOnChange: boolean;\n    isOnTouch: boolean;\n    isOnAll: boolean;\n  }>,\n) => {\n  if (mode.isOnAll) {\n    return false;\n  } else if (!isSubmitted && mode.isOnTouch) {\n    return !(isTouched || isBlurEvent);\n  } else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) {\n    return !isBlurEvent;\n  } else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) {\n    return isBlurEvent;\n  }\n  return true;\n};\n","import compact from '../utils/compact';\nimport get from '../utils/get';\nimport unset from '../utils/unset';\n\nexport default <T>(ref: T, name: string) =>\n  !compact(get(ref, name)).length && unset(ref, name);\n","import { EVENTS, VALIDATION_MODE } from '../constants';\nimport {\n  BatchFieldArrayUpdate,\n  ChangeHandler,\n  DeepPartial,\n  DelayCallback,\n  EventType,\n  Field,\n  FieldError,\n  FieldNamesMarkedBoolean,\n  FieldPath,\n  FieldRefs,\n  FieldValues,\n  FormState,\n  GetIsDirty,\n  InternalFieldName,\n  Names,\n  Path,\n  Ref,\n  ResolverResult,\n  SetFieldValue,\n  SetValueConfig,\n  Subjects,\n  UseFormClearErrors,\n  UseFormGetFieldState,\n  UseFormGetValues,\n  UseFormHandleSubmit,\n  UseFormProps,\n  UseFormRegister,\n  UseFormReset,\n  UseFormResetField,\n  UseFormReturn,\n  UseFormSetError,\n  UseFormSetFocus,\n  UseFormSetValue,\n  UseFormTrigger,\n  UseFormUnregister,\n  UseFormWatch,\n  WatchInternal,\n  WatchObserver,\n} from '../types';\nimport cloneObject from '../utils/cloneObject';\nimport compact from '../utils/compact';\nimport convertToArrayPayload from '../utils/convertToArrayPayload';\nimport createSubject from '../utils/createSubject';\nimport deepEqual from '../utils/deepEqual';\nimport get from '../utils/get';\nimport getValidationModes from '../utils/getValidationModes';\nimport isBoolean from '../utils/isBoolean';\nimport isCheckBoxInput from '../utils/isCheckBoxInput';\nimport isDateObject from '../utils/isDateObject';\nimport isEmptyObject from '../utils/isEmptyObject';\nimport isFileInput from '../utils/isFileInput';\nimport isFunction from '../utils/isFunction';\nimport isHTMLElement from '../utils/isHTMLElement';\nimport isMultipleSelect from '../utils/isMultipleSelect';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport isPrimitive from '../utils/isPrimitive';\nimport isRadioOrCheckbox from '../utils/isRadioOrCheckbox';\nimport isString from '../utils/isString';\nimport isUndefined from '../utils/isUndefined';\nimport isWeb from '../utils/isWeb';\nimport live from '../utils/live';\nimport set from '../utils/set';\nimport unset from '../utils/unset';\n\nimport focusFieldBy from './focusFieldBy';\nimport generateWatchOutput from './generateWatchOutput';\nimport getDirtyFields from './getDirtyFields';\nimport getEventValue from './getEventValue';\nimport getFieldValue from './getFieldValue';\nimport getFieldValueAs from './getFieldValueAs';\nimport getResolverOptions from './getResolverOptions';\nimport getRuleValue from './getRuleValue';\nimport hasValidation from './hasValidation';\nimport isNameInFieldArray from './isNameInFieldArray';\nimport isWatched from './isWatched';\nimport schemaErrorLookup from './schemaErrorLookup';\nimport skipValidation from './skipValidation';\nimport unsetEmptyArray from './unsetEmptyArray';\nimport updateFieldArrayRootError from './updateFieldArrayRootError';\nimport validateField from './validateField';\n\nconst defaultOptions = {\n  mode: VALIDATION_MODE.onSubmit,\n  reValidateMode: VALIDATION_MODE.onChange,\n  shouldFocusError: true,\n} as const;\n\nexport function createFormControl<\n  TFieldValues extends FieldValues = FieldValues,\n  TContext = any,\n>(\n  props: UseFormProps<TFieldValues, TContext> = {},\n): Omit<UseFormReturn<TFieldValues, TContext>, 'formState'> {\n  let _options = {\n    ...defaultOptions,\n    ...props,\n  };\n  let _formState: FormState<TFieldValues> = {\n    submitCount: 0,\n    isDirty: false,\n    isValidating: false,\n    isSubmitted: false,\n    isSubmitting: false,\n    isSubmitSuccessful: false,\n    isValid: false,\n    touchedFields: {},\n    dirtyFields: {},\n    errors: {},\n  };\n  let _fields = {};\n  let _defaultValues = cloneObject(_options.defaultValues) || {};\n  let _formValues = _options.shouldUnregister\n    ? {}\n    : cloneObject(_defaultValues);\n  let _stateFlags = {\n    action: false,\n    mount: false,\n    watch: false,\n  };\n  let _names: Names = {\n    mount: new Set(),\n    unMount: new Set(),\n    array: new Set(),\n    watch: new Set(),\n  } as Names;\n  let delayErrorCallback: DelayCallback | null;\n  let timer = 0;\n  let validateFields: Record<InternalFieldName, number> = {};\n  const _proxyFormState = {\n    isDirty: false,\n    dirtyFields: false,\n    touchedFields: false,\n    isValidating: false,\n    isValid: false,\n    errors: false,\n  };\n  const _subjects: Subjects<TFieldValues> = {\n    watch: createSubject(),\n    array: createSubject(),\n    state: createSubject(),\n  };\n\n  const validationModeBeforeSubmit = getValidationModes(_options.mode);\n  const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);\n  const shouldDisplayAllAssociatedErrors =\n    _options.criteriaMode === VALIDATION_MODE.all;\n\n  const debounce =\n    <T extends Function>(callback: T) =>\n    (wait: number) => {\n      clearTimeout(timer);\n      timer = window.setTimeout(callback, wait);\n    };\n\n  const _updateValid = async (shouldSkipRender?: boolean) => {\n    let isValid = false;\n\n    if (_proxyFormState.isValid) {\n      isValid = _options.resolver\n        ? isEmptyObject((await _executeSchema()).errors)\n        : await executeBuiltInValidation(_fields, true);\n\n      if (!shouldSkipRender && isValid !== _formState.isValid) {\n        _formState.isValid = isValid;\n        _subjects.state.next({\n          isValid,\n        });\n      }\n    }\n\n    return isValid;\n  };\n\n  const _updateFieldArray: BatchFieldArrayUpdate = (\n    name,\n    values = [],\n    method,\n    args,\n    shouldSetValues = true,\n    shouldUpdateFieldsAndState = true,\n  ) => {\n    if (args && method) {\n      _stateFlags.action = true;\n      if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {\n        const fieldValues = method(get(_fields, name), args.argA, args.argB);\n        shouldSetValues && set(_fields, name, fieldValues);\n      }\n\n      if (\n        _proxyFormState.errors &&\n        shouldUpdateFieldsAndState &&\n        Array.isArray(get(_formState.errors, name))\n      ) {\n        const errors = method(\n          get(_formState.errors, name),\n          args.argA,\n          args.argB,\n        );\n        shouldSetValues && set(_formState.errors, name, errors);\n        unsetEmptyArray(_formState.errors, name);\n      }\n\n      if (\n        _proxyFormState.touchedFields &&\n        shouldUpdateFieldsAndState &&\n        Array.isArray(get(_formState.touchedFields, name))\n      ) {\n        const touchedFields = method(\n          get(_formState.touchedFields, name),\n          args.argA,\n          args.argB,\n        );\n        shouldSetValues && set(_formState.touchedFields, name, touchedFields);\n      }\n\n      if (_proxyFormState.dirtyFields) {\n        _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\n      }\n\n      _subjects.state.next({\n        isDirty: _getDirty(name, values),\n        dirtyFields: _formState.dirtyFields,\n        errors: _formState.errors,\n        isValid: _formState.isValid,\n      });\n    } else {\n      set(_formValues, name, values);\n    }\n  };\n\n  const updateErrors = (name: InternalFieldName, error: FieldError) => {\n    set(_formState.errors, name, error);\n    _subjects.state.next({\n      errors: _formState.errors,\n    });\n  };\n\n  const updateValidAndValue = (\n    name: InternalFieldName,\n    shouldSkipSetValueAs: boolean,\n    value?: unknown,\n    ref?: Ref,\n  ) => {\n    const field: Field = get(_fields, name);\n\n    if (field) {\n      const defaultValue = get(\n        _formValues,\n        name,\n        isUndefined(value) ? get(_defaultValues, name) : value,\n      );\n\n      isUndefined(defaultValue) ||\n      (ref && (ref as HTMLInputElement).defaultChecked) ||\n      shouldSkipSetValueAs\n        ? set(\n            _formValues,\n            name,\n            shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f),\n          )\n        : setFieldValue(name, defaultValue);\n\n      _stateFlags.mount && _updateValid();\n    }\n  };\n\n  const updateTouchAndDirty = (\n    name: InternalFieldName,\n    fieldValue: unknown,\n    isBlurEvent?: boolean,\n    shouldDirty?: boolean,\n    shouldRender?: boolean,\n  ): Partial<\n    Pick<FormState<TFieldValues>, 'dirtyFields' | 'isDirty' | 'touchedFields'>\n  > => {\n    let isFieldDirty = false;\n    const output: Partial<FormState<TFieldValues>> & { name: string } = {\n      name,\n    };\n    const isPreviousFieldTouched = get(_formState.touchedFields, name);\n\n    if (_proxyFormState.isDirty) {\n      const isPreviousFormDirty = _formState.isDirty;\n\n      _formState.isDirty = output.isDirty = _getDirty();\n      isFieldDirty = isPreviousFormDirty !== output.isDirty;\n    }\n\n    if (_proxyFormState.dirtyFields && (!isBlurEvent || shouldDirty)) {\n      const isPreviousFieldDirty = get(_formState.dirtyFields, name);\n      const isCurrentFieldPristine = deepEqual(\n        get(_defaultValues, name),\n        fieldValue,\n      );\n\n      isCurrentFieldPristine\n        ? unset(_formState.dirtyFields, name)\n        : set(_formState.dirtyFields, name, true);\n      output.dirtyFields = _formState.dirtyFields;\n      isFieldDirty =\n        isFieldDirty ||\n        isPreviousFieldDirty !== get(_formState.dirtyFields, name);\n    }\n\n    if (isBlurEvent && !isPreviousFieldTouched) {\n      set(_formState.touchedFields, name, isBlurEvent);\n      output.touchedFields = _formState.touchedFields;\n      isFieldDirty =\n        isFieldDirty ||\n        (_proxyFormState.touchedFields &&\n          isPreviousFieldTouched !== isBlurEvent);\n    }\n\n    isFieldDirty && shouldRender && _subjects.state.next(output);\n\n    return isFieldDirty ? output : {};\n  };\n\n  const shouldRenderByError = async (\n    name: InternalFieldName,\n    isValid: boolean,\n    error?: FieldError,\n    fieldState?: {\n      dirty?: FieldNamesMarkedBoolean<TFieldValues>;\n      isDirty?: boolean;\n      touched?: FieldNamesMarkedBoolean<TFieldValues>;\n    },\n  ): Promise<void> => {\n    const previousFieldError = get(_formState.errors, name);\n    const shouldUpdateValid =\n      _proxyFormState.isValid && _formState.isValid !== isValid;\n\n    if (props.delayError && error) {\n      delayErrorCallback = debounce(() => updateErrors(name, error));\n      delayErrorCallback(props.delayError);\n    } else {\n      clearTimeout(timer);\n      delayErrorCallback = null;\n      error\n        ? set(_formState.errors, name, error)\n        : unset(_formState.errors, name);\n    }\n\n    if (\n      (error ? !deepEqual(previousFieldError, error) : previousFieldError) ||\n      !isEmptyObject(fieldState) ||\n      shouldUpdateValid\n    ) {\n      const updatedFormState = {\n        ...fieldState,\n        ...(shouldUpdateValid ? { isValid } : {}),\n        errors: _formState.errors,\n        name,\n      };\n\n      _formState = {\n        ..._formState,\n        ...updatedFormState,\n      };\n\n      _subjects.state.next(updatedFormState);\n    }\n\n    validateFields[name]--;\n\n    if (\n      _proxyFormState.isValidating &&\n      !Object.values(validateFields).some((v) => v)\n    ) {\n      _subjects.state.next({\n        isValidating: false,\n      });\n      validateFields = {};\n    }\n  };\n\n  const _executeSchema = async (name?: InternalFieldName[]) =>\n    _options.resolver\n      ? await _options.resolver(\n          { ..._formValues } as TFieldValues,\n          _options.context,\n          getResolverOptions(\n            name || _names.mount,\n            _fields,\n            _options.criteriaMode,\n            _options.shouldUseNativeValidation,\n          ),\n        )\n      : ({} as ResolverResult<TFieldValues>);\n\n  const executeSchemaAndUpdateState = async (names?: InternalFieldName[]) => {\n    const { errors } = await _executeSchema();\n\n    if (names) {\n      for (const name of names) {\n        const error = get(errors, name);\n        error\n          ? set(_formState.errors, name, error)\n          : unset(_formState.errors, name);\n      }\n    } else {\n      _formState.errors = errors;\n    }\n\n    return errors;\n  };\n\n  const executeBuiltInValidation = async (\n    fields: FieldRefs,\n    shouldOnlyCheckValid?: boolean,\n    context = {\n      valid: true,\n    },\n  ) => {\n    for (const name in fields) {\n      const field = fields[name];\n\n      if (field) {\n        const { _f, ...fieldValue } = field;\n\n        if (_f) {\n          const isFieldArrayRoot = _names.array.has(_f.name);\n          const fieldError = await validateField(\n            field,\n            get(_formValues, _f.name),\n            shouldDisplayAllAssociatedErrors,\n            _options.shouldUseNativeValidation,\n            isFieldArrayRoot,\n          );\n\n          if (fieldError[_f.name]) {\n            context.valid = false;\n\n            if (shouldOnlyCheckValid) {\n              break;\n            }\n          }\n\n          !shouldOnlyCheckValid &&\n            (get(fieldError, _f.name)\n              ? isFieldArrayRoot\n                ? updateFieldArrayRootError(\n                    _formState.errors,\n                    fieldError,\n                    _f.name,\n                  )\n                : set(_formState.errors, _f.name, fieldError[_f.name])\n              : unset(_formState.errors, _f.name));\n        }\n\n        fieldValue &&\n          (await executeBuiltInValidation(\n            fieldValue,\n            shouldOnlyCheckValid,\n            context,\n          ));\n      }\n    }\n\n    return context.valid;\n  };\n\n  const _removeUnmounted = () => {\n    for (const name of _names.unMount) {\n      const field: Field = get(_fields, name);\n\n      field &&\n        (field._f.refs\n          ? field._f.refs.every((ref) => !live(ref))\n          : !live(field._f.ref)) &&\n        unregister(name as FieldPath<TFieldValues>);\n    }\n\n    _names.unMount = new Set();\n  };\n\n  const _getDirty: GetIsDirty = (name, data) => (\n    name && data && set(_formValues, name, data),\n    !deepEqual(getValues(), _defaultValues)\n  );\n\n  const _getWatch: WatchInternal<TFieldValues> = (\n    names,\n    defaultValue,\n    isGlobal,\n  ) => {\n    const fieldValues = {\n      ...(_stateFlags.mount\n        ? _formValues\n        : isUndefined(defaultValue)\n        ? _defaultValues\n        : isString(names)\n        ? { [names]: defaultValue }\n        : defaultValue),\n    };\n\n    return generateWatchOutput(names, _names, fieldValues, isGlobal);\n  };\n\n  const _getFieldArray = <TFieldArrayValues>(\n    name: InternalFieldName,\n  ): Partial<TFieldArrayValues>[] =>\n    compact(\n      get(\n        _stateFlags.mount ? _formValues : _defaultValues,\n        name,\n        props.shouldUnregister ? get(_defaultValues, name, []) : [],\n      ),\n    );\n\n  const setFieldValue = (\n    name: InternalFieldName,\n    value: SetFieldValue<TFieldValues>,\n    options: SetValueConfig = {},\n  ) => {\n    const field: Field = get(_fields, name);\n    let fieldValue: unknown = value;\n\n    if (field) {\n      const fieldReference = field._f;\n\n      if (fieldReference) {\n        !fieldReference.disabled &&\n          set(_formValues, name, getFieldValueAs(value, fieldReference));\n\n        fieldValue =\n          isWeb && isHTMLElement(fieldReference.ref) && isNullOrUndefined(value)\n            ? ''\n            : value;\n\n        if (isMultipleSelect(fieldReference.ref)) {\n          [...fieldReference.ref.options].forEach(\n            (optionRef) =>\n              (optionRef.selected = (\n                fieldValue as InternalFieldName[]\n              ).includes(optionRef.value)),\n          );\n        } else if (fieldReference.refs) {\n          if (isCheckBoxInput(fieldReference.ref)) {\n            fieldReference.refs.length > 1\n              ? fieldReference.refs.forEach(\n                  (checkboxRef) =>\n                    (!checkboxRef.defaultChecked || !checkboxRef.disabled) &&\n                    (checkboxRef.checked = Array.isArray(fieldValue)\n                      ? !!(fieldValue as []).find(\n                          (data: string) => data === checkboxRef.value,\n                        )\n                      : fieldValue === checkboxRef.value),\n                )\n              : fieldReference.refs[0] &&\n                (fieldReference.refs[0].checked = !!fieldValue);\n          } else {\n            fieldReference.refs.forEach(\n              (radioRef: HTMLInputElement) =>\n                (radioRef.checked = radioRef.value === fieldValue),\n            );\n          }\n        } else if (isFileInput(fieldReference.ref)) {\n          fieldReference.ref.value = '';\n        } else {\n          fieldReference.ref.value = fieldValue;\n\n          if (!fieldReference.ref.type) {\n            _subjects.watch.next({\n              name,\n            });\n          }\n        }\n      }\n    }\n\n    (options.shouldDirty || options.shouldTouch) &&\n      updateTouchAndDirty(\n        name,\n        fieldValue,\n        options.shouldTouch,\n        options.shouldDirty,\n        true,\n      );\n\n    options.shouldValidate && trigger(name as Path<TFieldValues>);\n  };\n\n  const setValues = <\n    T extends InternalFieldName,\n    K extends SetFieldValue<TFieldValues>,\n    U extends SetValueConfig,\n  >(\n    name: T,\n    value: K,\n    options: U,\n  ) => {\n    for (const fieldKey in value) {\n      const fieldValue = value[fieldKey];\n      const fieldName = `${name}.${fieldKey}` as Path<TFieldValues>;\n      const field = get(_fields, fieldName);\n\n      (_names.array.has(name) ||\n        !isPrimitive(fieldValue) ||\n        (field && !field._f)) &&\n      !isDateObject(fieldValue)\n        ? setValues(fieldName, fieldValue, options)\n        : setFieldValue(fieldName, fieldValue, options);\n    }\n  };\n\n  const setValue: UseFormSetValue<TFieldValues> = (\n    name,\n    value,\n    options = {},\n  ) => {\n    const field = get(_fields, name);\n    const isFieldArray = _names.array.has(name);\n    const cloneValue = cloneObject(value);\n\n    set(_formValues, name, cloneValue);\n\n    if (isFieldArray) {\n      _subjects.array.next({\n        name,\n        values: _formValues,\n      });\n\n      if (\n        (_proxyFormState.isDirty || _proxyFormState.dirtyFields) &&\n        options.shouldDirty\n      ) {\n        _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\n\n        _subjects.state.next({\n          name,\n          dirtyFields: _formState.dirtyFields,\n          isDirty: _getDirty(name, cloneValue),\n        });\n      }\n    } else {\n      field && !field._f && !isNullOrUndefined(cloneValue)\n        ? setValues(name, cloneValue, options)\n        : setFieldValue(name, cloneValue, options);\n    }\n\n    isWatched(name, _names) && _subjects.state.next({});\n    _subjects.watch.next({\n      name,\n    });\n  };\n\n  const onChange: ChangeHandler = async (event) => {\n    const target = event.target;\n    let name = target.name;\n    const field: Field = get(_fields, name);\n\n    if (field) {\n      let error;\n      let isValid;\n      const fieldValue = target.type\n        ? getFieldValue(field._f)\n        : getEventValue(event);\n      const isBlurEvent =\n        event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;\n      const shouldSkipValidation =\n        (!hasValidation(field._f) &&\n          !_options.resolver &&\n          !get(_formState.errors, name) &&\n          !field._f.deps) ||\n        skipValidation(\n          isBlurEvent,\n          get(_formState.touchedFields, name),\n          _formState.isSubmitted,\n          validationModeAfterSubmit,\n          validationModeBeforeSubmit,\n        );\n      const watched = isWatched(name, _names, isBlurEvent);\n\n      set(_formValues, name, fieldValue);\n\n      if (isBlurEvent) {\n        field._f.onBlur && field._f.onBlur(event);\n        delayErrorCallback && delayErrorCallback(0);\n      } else if (field._f.onChange) {\n        field._f.onChange(event);\n      }\n\n      const fieldState = updateTouchAndDirty(\n        name,\n        fieldValue,\n        isBlurEvent,\n        false,\n      );\n\n      const shouldRender = !isEmptyObject(fieldState) || watched;\n\n      !isBlurEvent &&\n        _subjects.watch.next({\n          name,\n          type: event.type,\n        });\n\n      if (shouldSkipValidation) {\n        return (\n          shouldRender &&\n          _subjects.state.next({ name, ...(watched ? {} : fieldState) })\n        );\n      }\n\n      !isBlurEvent && watched && _subjects.state.next({});\n\n      validateFields[name] = validateFields[name] ? +1 : 1;\n\n      _subjects.state.next({\n        isValidating: true,\n      });\n\n      if (_options.resolver) {\n        const { errors } = await _executeSchema([name]);\n        const previousErrorLookupResult = schemaErrorLookup(\n          _formState.errors,\n          _fields,\n          name,\n        );\n        const errorLookupResult = schemaErrorLookup(\n          errors,\n          _fields,\n          previousErrorLookupResult.name || name,\n        );\n\n        error = errorLookupResult.error;\n        name = errorLookupResult.name;\n\n        isValid = isEmptyObject(errors);\n      } else {\n        error = (\n          await validateField(\n            field,\n            get(_formValues, name),\n            shouldDisplayAllAssociatedErrors,\n            _options.shouldUseNativeValidation,\n          )\n        )[name];\n\n        isValid = await _updateValid(true);\n      }\n\n      field._f.deps &&\n        trigger(\n          field._f.deps as FieldPath<TFieldValues> | FieldPath<TFieldValues>[],\n        );\n\n      shouldRenderByError(name, isValid, error, fieldState);\n    }\n  };\n\n  const trigger: UseFormTrigger<TFieldValues> = async (name, options = {}) => {\n    let isValid;\n    let validationResult;\n    const fieldNames = convertToArrayPayload(name) as InternalFieldName[];\n\n    _subjects.state.next({\n      isValidating: true,\n    });\n\n    if (_options.resolver) {\n      const errors = await executeSchemaAndUpdateState(\n        isUndefined(name) ? name : fieldNames,\n      );\n\n      isValid = isEmptyObject(errors);\n      validationResult = name\n        ? !fieldNames.some((name) => get(errors, name))\n        : isValid;\n    } else if (name) {\n      validationResult = (\n        await Promise.all(\n          fieldNames.map(async (fieldName) => {\n            const field = get(_fields, fieldName);\n            return await executeBuiltInValidation(\n              field && field._f ? { [fieldName]: field } : field,\n            );\n          }),\n        )\n      ).every(Boolean);\n      !(!validationResult && !_formState.isValid) && _updateValid();\n    } else {\n      validationResult = isValid = await executeBuiltInValidation(_fields);\n    }\n\n    _subjects.state.next({\n      ...(!isString(name) ||\n      (_proxyFormState.isValid && isValid !== _formState.isValid)\n        ? {}\n        : { name }),\n      ...(_options.resolver || !name ? { isValid } : {}),\n      errors: _formState.errors,\n      isValidating: false,\n    });\n\n    options.shouldFocus &&\n      !validationResult &&\n      focusFieldBy(\n        _fields,\n        (key) => key && get(_formState.errors, key),\n        name ? fieldNames : _names.mount,\n      );\n\n    return validationResult;\n  };\n\n  const getValues: UseFormGetValues<TFieldValues> = (\n    fieldNames?:\n      | FieldPath<TFieldValues>\n      | ReadonlyArray<FieldPath<TFieldValues>>,\n  ) => {\n    const values = {\n      ..._defaultValues,\n      ...(_stateFlags.mount ? _formValues : {}),\n    };\n\n    return isUndefined(fieldNames)\n      ? values\n      : isString(fieldNames)\n      ? get(values, fieldNames as InternalFieldName)\n      : fieldNames.map((name) => get(values, name as InternalFieldName));\n  };\n\n  const getFieldState: UseFormGetFieldState<TFieldValues> = (\n    name,\n    formState,\n  ) => ({\n    invalid: !!get((formState || _formState).errors, name),\n    isDirty: !!get((formState || _formState).dirtyFields, name),\n    isTouched: !!get((formState || _formState).touchedFields, name),\n    error: get((formState || _formState).errors, name),\n  });\n\n  const clearErrors: UseFormClearErrors<TFieldValues> = (name) => {\n    name\n      ? convertToArrayPayload(name).forEach((inputName) =>\n          unset(_formState.errors, inputName),\n        )\n      : (_formState.errors = {});\n\n    _subjects.state.next({\n      errors: _formState.errors,\n    });\n  };\n\n  const setError: UseFormSetError<TFieldValues> = (name, error, options) => {\n    const ref = ((get(_fields, name, { _f: {} }) as Field)._f || {}).ref;\n\n    set(_formState.errors, name, {\n      ...error,\n      ref,\n    });\n\n    _subjects.state.next({\n      name,\n      errors: _formState.errors,\n      isValid: false,\n    });\n\n    options && options.shouldFocus && ref && ref.focus && ref.focus();\n  };\n\n  const watch: UseFormWatch<TFieldValues> = (\n    name?:\n      | FieldPath<TFieldValues>\n      | ReadonlyArray<FieldPath<TFieldValues>>\n      | WatchObserver<TFieldValues>,\n    defaultValue?: unknown,\n  ) =>\n    isFunction(name)\n      ? _subjects.watch.subscribe({\n          next: (info) =>\n            name(\n              _getWatch(undefined, defaultValue as DeepPartial<TFieldValues>),\n              info as {\n                name?: FieldPath<TFieldValues>;\n                type?: EventType;\n                value?: unknown;\n              },\n            ),\n        })\n      : _getWatch(\n          name as InternalFieldName | InternalFieldName[],\n          defaultValue as DeepPartial<TFieldValues>,\n          true,\n        );\n\n  const unregister: UseFormUnregister<TFieldValues> = (name, options = {}) => {\n    for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {\n      _names.mount.delete(fieldName);\n      _names.array.delete(fieldName);\n\n      if (get(_fields, fieldName)) {\n        if (!options.keepValue) {\n          unset(_fields, fieldName);\n          unset(_formValues, fieldName);\n        }\n\n        !options.keepError && unset(_formState.errors, fieldName);\n        !options.keepDirty && unset(_formState.dirtyFields, fieldName);\n        !options.keepTouched && unset(_formState.touchedFields, fieldName);\n        !_options.shouldUnregister &&\n          !options.keepDefaultValue &&\n          unset(_defaultValues, fieldName);\n      }\n    }\n\n    _subjects.watch.next({});\n\n    _subjects.state.next({\n      ..._formState,\n      ...(!options.keepDirty ? {} : { isDirty: _getDirty() }),\n    });\n\n    !options.keepIsValid && _updateValid();\n  };\n\n  const register: UseFormRegister<TFieldValues> = (name, options = {}) => {\n    let field = get(_fields, name);\n    const disabledIsDefined = isBoolean(options.disabled);\n\n    set(_fields, name, {\n      ...(field || {}),\n      _f: {\n        ...(field && field._f ? field._f : { ref: { name } }),\n        name,\n        mount: true,\n        ...options,\n      },\n    });\n    _names.mount.add(name);\n\n    field\n      ? disabledIsDefined &&\n        set(\n          _formValues,\n          name,\n          options.disabled\n            ? undefined\n            : get(_formValues, name, getFieldValue(field._f)),\n        )\n      : updateValidAndValue(name, true, options.value);\n\n    return {\n      ...(disabledIsDefined ? { disabled: options.disabled } : {}),\n      ...(_options.shouldUseNativeValidation\n        ? {\n            required: !!options.required,\n            min: getRuleValue(options.min),\n            max: getRuleValue(options.max),\n            minLength: getRuleValue<number>(options.minLength) as number,\n            maxLength: getRuleValue(options.maxLength) as number,\n            pattern: getRuleValue(options.pattern) as string,\n          }\n        : {}),\n      name,\n      onChange,\n      onBlur: onChange,\n      ref: (ref: HTMLInputElement | null): void => {\n        if (ref) {\n          register(name, options);\n          field = get(_fields, name);\n\n          const fieldRef = isUndefined(ref.value)\n            ? ref.querySelectorAll\n              ? (ref.querySelectorAll('input,select,textarea')[0] as Ref) || ref\n              : ref\n            : ref;\n          const radioOrCheckbox = isRadioOrCheckbox(fieldRef);\n          const refs = field._f.refs || [];\n\n          if (\n            radioOrCheckbox\n              ? refs.find((option: Ref) => option === fieldRef)\n              : fieldRef === field._f.ref\n          ) {\n            return;\n          }\n\n          set(_fields, name, {\n            _f: {\n              ...field._f,\n              ...(radioOrCheckbox\n                ? {\n                    refs: [\n                      ...refs.filter(live),\n                      fieldRef,\n                      ...(!!Array.isArray(get(_defaultValues, name))\n                        ? [{}]\n                        : []),\n                    ],\n                    ref: { type: fieldRef.type, name },\n                  }\n                : { ref: fieldRef }),\n            },\n          });\n\n          updateValidAndValue(name, false, undefined, fieldRef);\n        } else {\n          field = get(_fields, name, {});\n\n          if (field._f) {\n            field._f.mount = false;\n          }\n\n          (_options.shouldUnregister || options.shouldUnregister) &&\n            !(isNameInFieldArray(_names.array, name) && _stateFlags.action) &&\n            _names.unMount.add(name);\n        }\n      },\n    };\n  };\n\n  const _focusError = () =>\n    _options.shouldFocusError &&\n    focusFieldBy(\n      _fields,\n      (key) => key && get(_formState.errors, key),\n      _names.mount,\n    );\n\n  const handleSubmit: UseFormHandleSubmit<TFieldValues> =\n    (onValid, onInvalid) => async (e) => {\n      if (e) {\n        e.preventDefault && e.preventDefault();\n        e.persist && e.persist();\n      }\n      let hasNoPromiseError = true;\n      let fieldValues: any = cloneObject(_formValues);\n\n      _subjects.state.next({\n        isSubmitting: true,\n      });\n\n      try {\n        if (_options.resolver) {\n          const { errors, values } = await _executeSchema();\n          _formState.errors = errors;\n          fieldValues = values;\n        } else {\n          await executeBuiltInValidation(_fields);\n        }\n\n        if (isEmptyObject(_formState.errors)) {\n          _subjects.state.next({\n            errors: {},\n            isSubmitting: true,\n          });\n          await onValid(fieldValues, e);\n        } else {\n          if (onInvalid) {\n            await onInvalid({ ..._formState.errors }, e);\n          }\n\n          _focusError();\n        }\n      } catch (err) {\n        hasNoPromiseError = false;\n        throw err;\n      } finally {\n        _formState.isSubmitted = true;\n        _subjects.state.next({\n          isSubmitted: true,\n          isSubmitting: false,\n          isSubmitSuccessful:\n            isEmptyObject(_formState.errors) && hasNoPromiseError,\n          submitCount: _formState.submitCount + 1,\n          errors: _formState.errors,\n        });\n      }\n    };\n\n  const resetField: UseFormResetField<TFieldValues> = (name, options = {}) => {\n    if (get(_fields, name)) {\n      if (isUndefined(options.defaultValue)) {\n        setValue(name, get(_defaultValues, name));\n      } else {\n        setValue(name, options.defaultValue);\n        set(_defaultValues, name, options.defaultValue);\n      }\n\n      if (!options.keepTouched) {\n        unset(_formState.touchedFields, name);\n      }\n\n      if (!options.keepDirty) {\n        unset(_formState.dirtyFields, name);\n        _formState.isDirty = options.defaultValue\n          ? _getDirty(name, get(_defaultValues, name))\n          : _getDirty();\n      }\n\n      if (!options.keepError) {\n        unset(_formState.errors, name);\n        _proxyFormState.isValid && _updateValid();\n      }\n\n      _subjects.state.next({ ..._formState });\n    }\n  };\n\n  const _reset: UseFormReset<TFieldValues> = (\n    formValues,\n    keepStateOptions = {},\n  ) => {\n    const updatedValues = formValues || _defaultValues;\n    const cloneUpdatedValues = cloneObject(updatedValues);\n    const values =\n      formValues && !isEmptyObject(formValues)\n        ? cloneUpdatedValues\n        : _defaultValues;\n\n    if (!keepStateOptions.keepDefaultValues) {\n      _defaultValues = updatedValues;\n    }\n\n    if (!keepStateOptions.keepValues) {\n      if (keepStateOptions.keepDirtyValues) {\n        for (const fieldName of _names.mount) {\n          get(_formState.dirtyFields, fieldName)\n            ? set(values, fieldName, get(_formValues, fieldName))\n            : setValue(\n                fieldName as FieldPath<TFieldValues>,\n                get(values, fieldName),\n              );\n        }\n      } else {\n        if (isWeb && isUndefined(formValues)) {\n          for (const name of _names.mount) {\n            const field = get(_fields, name);\n            if (field && field._f) {\n              const fieldReference = Array.isArray(field._f.refs)\n                ? field._f.refs[0]\n                : field._f.ref;\n\n              try {\n                if (isHTMLElement(fieldReference)) {\n                  fieldReference.closest('form')!.reset();\n                  break;\n                }\n              } catch {}\n            }\n          }\n        }\n\n        _fields = {};\n      }\n\n      _formValues = props.shouldUnregister\n        ? keepStateOptions.keepDefaultValues\n          ? cloneObject(_defaultValues)\n          : {}\n        : cloneUpdatedValues;\n\n      _subjects.array.next({\n        values,\n      });\n\n      _subjects.watch.next({\n        values,\n      });\n    }\n\n    _names = {\n      mount: new Set(),\n      unMount: new Set(),\n      array: new Set(),\n      watch: new Set(),\n      watchAll: false,\n      focus: '',\n    };\n\n    _stateFlags.mount =\n      !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;\n\n    _stateFlags.watch = !!props.shouldUnregister;\n\n    _subjects.state.next({\n      submitCount: keepStateOptions.keepSubmitCount\n        ? _formState.submitCount\n        : 0,\n      isDirty:\n        keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues\n          ? _formState.isDirty\n          : !!(\n              keepStateOptions.keepDefaultValues &&\n              !deepEqual(formValues, _defaultValues)\n            ),\n      isSubmitted: keepStateOptions.keepIsSubmitted\n        ? _formState.isSubmitted\n        : false,\n      dirtyFields:\n        keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues\n          ? _formState.dirtyFields\n          : keepStateOptions.keepDefaultValues && formValues\n          ? getDirtyFields(_defaultValues, formValues)\n          : {},\n      touchedFields: keepStateOptions.keepTouched\n        ? _formState.touchedFields\n        : {},\n      errors: keepStateOptions.keepErrors ? _formState.errors : {},\n      isSubmitting: false,\n      isSubmitSuccessful: false,\n    });\n  };\n\n  const reset: UseFormReset<TFieldValues> = (formValues, keepStateOptions) =>\n    _reset(\n      isFunction(formValues)\n        ? formValues(_formValues as TFieldValues)\n        : formValues,\n      keepStateOptions,\n    );\n\n  const setFocus: UseFormSetFocus<TFieldValues> = (name, options = {}) => {\n    const field = get(_fields, name);\n    const fieldReference = field && field._f;\n\n    if (fieldReference) {\n      const fieldRef = fieldReference.refs\n        ? fieldReference.refs[0]\n        : fieldReference.ref;\n\n      if (fieldRef.focus) {\n        fieldRef.focus();\n        options.shouldSelect && fieldRef.select();\n      }\n    }\n  };\n\n  return {\n    control: {\n      register,\n      unregister,\n      getFieldState,\n      _executeSchema,\n      _focusError,\n      _getWatch,\n      _getDirty,\n      _updateValid,\n      _removeUnmounted,\n      _updateFieldArray,\n      _getFieldArray,\n      _subjects,\n      _proxyFormState,\n      get _fields() {\n        return _fields;\n      },\n      get _formValues() {\n        return _formValues;\n      },\n      get _stateFlags() {\n        return _stateFlags;\n      },\n      set _stateFlags(value) {\n        _stateFlags = value;\n      },\n      get _defaultValues() {\n        return _defaultValues;\n      },\n      get _names() {\n        return _names;\n      },\n      set _names(value) {\n        _names = value;\n      },\n      get _formState() {\n        return _formState;\n      },\n      set _formState(value) {\n        _formState = value;\n      },\n      get _options() {\n        return _options;\n      },\n      set _options(value) {\n        _options = {\n          ..._options,\n          ...value,\n        };\n      },\n    },\n    trigger,\n    register,\n    handleSubmit,\n    watch,\n    setValue,\n    getValues,\n    reset,\n    resetField,\n    clearErrors,\n    unregister,\n    setError,\n    setFocus,\n    getFieldState,\n  };\n}\n","import React from 'react';\n\nimport { createFormControl } from './logic/createFormControl';\nimport getProxyFormState from './logic/getProxyFormState';\nimport shouldRenderFormState from './logic/shouldRenderFormState';\nimport { FieldValues, FormState, UseFormProps, UseFormReturn } from './types';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * Custom hook to manage the entire form.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useform) • [Demo](https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm) • [Video](https://www.youtube.com/watch?v=RkXv4AXXC_4)\n *\n * @param props - form configuration and validation parameters.\n *\n * @returns methods - individual functions to manage the form state. {@link UseFormReturn}\n *\n * @example\n * ```tsx\n * function App() {\n *   const { register, handleSubmit, watch, formState: { errors } } = useForm();\n *   const onSubmit = data => console.log(data);\n *\n *   console.log(watch(\"example\"));\n *\n *   return (\n *     <form onSubmit={handleSubmit(onSubmit)}>\n *       <input defaultValue=\"test\" {...register(\"example\")} />\n *       <input {...register(\"exampleRequired\", { required: true })} />\n *       {errors.exampleRequired && <span>This field is required</span>}\n *       <input type=\"submit\" />\n *     </form>\n *   );\n * }\n * ```\n */\nexport function useForm<\n  TFieldValues extends FieldValues = FieldValues,\n  TContext = any,\n>(\n  props: UseFormProps<TFieldValues, TContext> = {},\n): UseFormReturn<TFieldValues, TContext> {\n  const _formControl = React.useRef<\n    UseFormReturn<TFieldValues, TContext> | undefined\n  >();\n  const [formState, updateFormState] = React.useState<FormState<TFieldValues>>({\n    isDirty: false,\n    isValidating: false,\n    isSubmitted: false,\n    isSubmitting: false,\n    isSubmitSuccessful: false,\n    isValid: false,\n    submitCount: 0,\n    dirtyFields: {},\n    touchedFields: {},\n    errors: {},\n    defaultValues: props.defaultValues,\n  });\n\n  if (!_formControl.current) {\n    _formControl.current = {\n      ...createFormControl(props),\n      formState,\n    };\n  }\n\n  const control = _formControl.current.control;\n  control._options = props;\n\n  useSubscribe({\n    subject: control._subjects.state,\n    callback: React.useCallback(\n      (value: FieldValues) => {\n        if (shouldRenderFormState(value, control._proxyFormState, true)) {\n          control._formState = {\n            ...control._formState,\n            ...value,\n          };\n\n          updateFormState({ ...control._formState });\n        }\n      },\n      [control],\n    ),\n  });\n\n  React.useEffect(() => {\n    if (!control._stateFlags.mount) {\n      control._proxyFormState.isValid && control._updateValid();\n      control._stateFlags.mount = true;\n    }\n\n    if (control._stateFlags.watch) {\n      control._stateFlags.watch = false;\n      control._subjects.state.next({});\n    }\n\n    control._removeUnmounted();\n  });\n\n  React.useEffect(() => {\n    formState.submitCount && control._focusError();\n  }, [control, formState.submitCount]);\n\n  _formControl.current.formState = getProxyFormState(formState, control);\n\n  return _formControl.current;\n}\n"]},"metadata":{},"sourceType":"module"}